我不小心使用了sudo pip安装,后来发现这是一种非常糟糕的做法。
我在运行sudo pip安装的最后看到了以下警告。
Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
然后每当我尝试在python代码中运行“import xxx”时,就会收到错误
Exception has occurred: AttributeError module 'collections' has no attribute 'MutableMapping' after sudo pip install
我正在使用MacOS,我想我把电脑搞砸了。。。请任何人帮忙。。
我读了这篇文章,但没有帮助:https://askubuntu.com/questions/1158271/how-to-fix-pip-after-running-it-with-sudo
我的终端在运行上述文章sudo find $HOME \! -user $USER -print | xargs ls -ld
中的代码后,没有返回任何与Python相关的文件