我嘗試從MacOSX中刪除所有安裝的pip軟件包。以下zsh循環刪除了其中的大部分,但一些抗拒。如何在MacOSX上清理pip安裝的軟件包?
for i ($(pip freeze)) {pip uninstall -y $i}
例如matlibplot尚未被刪除。當我嘗試運行卸載它找到matplotlib,打印相關的路徑,但失敗。
pip uninstall matplotlib
Uninstalling matplotlib-1.3.1:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib-1.3.1-py2.7.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pylab.py
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pylab.pyc
Proceed (y/n)?
我收到以下非常長的錯誤消息。看來,文件不能被刪除。錯誤示例:
error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py', '/tmp/pip-PK6UUB-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-PK6UUB-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py'"),
我該怎麼辦?
爲了清楚起見,命令從root帳戶運行。皮普可以找到包的元數據:
pip show matplotlib
---
Metadata-Version: 1.1
Name: matplotlib
Version: 1.3.1
Summary: Python plotting package
Home-page: http://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: [email protected]
License: BSD
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requires: numpy, python-dateutil, tornado, pyparsing, nose
Classifiers:
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: Python Software Foundation License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Visualization
以root或sudo身份運行。 – han058
我以root身份運行以上。 – Wawrzek
我將問題提交給AskDiffrent:http://apple.stackexchange.com/questions/235041/how-to-clean-pip-installed-packages-on-macosx/235050#235050因爲我的問題似乎是MacOSX特有的。 – Wawrzek