Smi*_*mal 0 python macos pip python-2.7 macos-high-sierra
我错误地使用pip在全局环境中安装了软件包。我想知道,如果它是一个好主意,卸载现有的Python提供的说明在OS上这里,并使用所提供的说明自制重新安装在这里了?或者有什么办法摆脱我使用pip安装的所有软件包及其依赖项。
我在macOS High Sierra上使用Python 2.7.10。编辑:建议方法的问题:
正如CloC在评论部分中建议的那样,我尝试通过键入以下内容从全局环境中卸载所有软件包:
pip freeze > to_delete.txt
Run Code Online (Sandbox Code Playgroud)
然后
sudo -H pip uninstall -y -r to_delete.txt
Run Code Online (Sandbox Code Playgroud)
但是我在终端中收到以下错误:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/basecommand.py", line 141, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/commands/uninstall.py", line 74, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/req/req_install.py", line 864, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/req/req_uninstall.py", line 221, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-18.0-py2.7.egg/pip/_internal/utils/misc.py", line 276, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py', '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib/dyld.py'"), [...], "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-3QWFII/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/macholib'")]
您当然不应该重新安装python才能进行全新的软件包安装。
通过首先列出并卸载它们,可以轻松地从全局环境中卸载所有软件包:
pip freeze > to_delete.txt
Run Code Online (Sandbox Code Playgroud)
然后:
pip uninstall -y -r to_delete.txt
Run Code Online (Sandbox Code Playgroud)
如果不想全部卸载,则可以删除要保留在to_delete.txt第一步中创建的文件中的行。
| 归档时间: |
|
| 查看次数: |
4138 次 |
| 最近记录: |