我正在尝试运行以下命令来卸载mac上的pip包:
pip freeze | xargs sudo pip uninstall -y(即使使用sudo -H标志,它也不起作用)
pip freeze为我提供了以下pip安装包的列表:
altgraph==0.10.2
bdist-mpkg==0.5.0
beautifulsoup4==4.5.3
bonjour-py==0.3
certifi==2017.11.5
chardet==3.0.4
认知面==1.3.1
dill==0.2.7.1
Django==1.11.6
djangorestframework==3.7.1
filemapper==0.1.3
future==0.16.0
idna==2.6
inflection==0.3.1
lxml==3.7.2
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
更多-itertools==4.0.1
ndg-httpsclient==0.4.3
ngrams==1.0.3
nltk==3.2.2
numpy==1.8.0rc1
py2app==0.7.3
pyasn1==0.4.2
pygame==1.9.3
pyobjc-core==2.5.1
pyobjc-framework-Accounts==2.5.1
pyobjc-framework-AddressBook==2.5.1
pyobjc-framework-AppleScriptKit==2.5.1
pyobjc-framework-AppleScriptObjC==2.5.1
pyobjc-framework-Automator==2.5.1
pyobjc-framework-CFNetwork==2.5.1
pyobjc-framework-Cocoa==2.5.1
pyobjc-framework-Collaboration==2.5.1
pyobjc-framework-CoreData==2.5.1
pyobjc-framework-CoreLocation==2.5.1
pyobjc-framework-CoreText==2.5.1
pyobjc-framework-DictionaryServices==2.5.1
pyobjc-framework-EventKit==2.5.1
pyobjc-framework-ExceptionHandling==2.5.1
pyobjc-framework-FSEvents==2.5.1
pyobjc-framework-InputMethodKit==2.5.1
pyobjc-framework-InstallerPlugins==2.5.1
pyobjc-framework-InstantMessage==2.5.1
pyobjc-framework-LatentSemanticMapping==2.5.1
pyobjc-framework-LaunchServices==2.5.1
pyobjc-framework-Message==2.5.1
pyobjc-framework-OpenDirectory==2.5.1
pyobjc-framework-PreferencePanes==2.5.1
pyobjc-framework-PubSub==2.5.1
pyobjc-framework-QTKit==2.5.1
pyobjc-framework-Quartz==2.5.1
pyobjc-framework-ScreenSaver==2.5.1
pyobjc-framework-ScriptingBridge==2.5.1
pyobjc-framework-SearchKit==2.5.1
pyobjc-framework-ServiceManagement==2.5.1
pyobjc-framework-Social==2.5.1
pyobjc-framework-SyncServices==2.5.1
pyobjc-framework-SystemConfiguration==2.5.1
pyobjc-framework-WebKit==2.5.1
pyOpenSSL==0.13.1
pyparsing==2.0.1
python-dateutil==1.5
pytz==2013.7
requests==2.18.4
scikit-learn==0.19.1
scipy==0.13.0b1
SimpleCV==1.3
six==1.4.1
sklearn==0.0
urllib3==1.22
xattr==0.6.4
zope.interface==4.1.1
使用pip freeze | xargs sudo pip uninstall -y,我得到了以下结果:
Uninstalling altgraph-0.10.2:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 346, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, 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/altgraph/__init__.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Dot.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/Graph.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphAlgo.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphStat.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/GraphUtil.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/ObjectGraph.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph', '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph', "[Errno 1] Operation not permitted: '/tmp/pip-YANgl9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph'")]
*/它只会在第一个包中停止卸载,甚至不会移动到其他包。我尝试使用pip uninstall <package-name>单独卸载包,但仍然不起作用,并且每次都会给出相同的错误语句序列。
我不知道我在哪里犯了错。我想重置所有pip安装的包,以重新开始并从头开始安装所需的包。
有没有人能帮我一下?
发布于 2018-01-19 02:19:10
我试图重现这个错误,我认为您应该传递参数xargs -n 1来引用每行的第一个块。否则,请尝试检查这是否不是特定于您的软件包的问题
https://stackoverflow.com/questions/48298170
复制相似问题