前言:我的OS X Python安裝是混亂。在我發現Homebrew之前,我開始使用系統Python方式。所以我一直在使用sudo pip install
。我現在正在嘗試清理所有東西,然後安裝/鏈接針對Homebrew Python的pip包。在OS X中不允許「sudo pip卸載」操作(/ tmp)El Capitan
1)在許多SO答案中,人們建議做:pip freeze | xargs sudo pip uninstall -y
這對我不起作用。我得到了很長的回溯。這是它的最有代表性的塊:
~ $ pip freeze | xargs sudo pip uninstall -y
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/Users/smaniato/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling altgraph-0.10.2:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
[...]
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-p8yIlU-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-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph/__init__.pyc',
[...]
"[Errno 1] Operation not permitted: '/tmp/pip-p8yIlU-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/altgraph'")]
其中altgraph
只是在pip list
第一PIP封裝(記住這一點)。
2)然後我嘗試pip freeze | xargs sudo -H pip uninstall -y
,因爲警告提示,但只是刪除警告。錯誤消息仍然存在。
3)我還嘗試過對任何引發投訴的目錄(例如,~/Library/Caches/pip
及其一些父母和子女)進行chown。出於某種原因,我不能chown
最容易出問題的目錄,/tmp
:
~ $ sudo chown -R ${USER} /tmp
chown: /tmp: Operation not permitted
4)最後,我手動試圖從卸載包進一步下跌的列表,瞧,我可以很容易例如做sudo pip uninstall virtualenv
。試圖手動卸載altgraph
導致上述相同的錯誤。
任何想法如何進行?請記住,我不關心任何一個包。我只是想要使用pip並從頭開始使用Homebrew的Python。謝謝!
更新:
- 手動下鄉名單,同樣的事情發生與
bdist-mpkg-0.5.0
- 一些更多:
matplotlib
,zope.interface
,xattr
,six
,scipy
,pytz
。
安裝ROS時,我遇到了完全相同的問題。這有幫助,謝謝! –
你必須從'site-packages'中刪除什麼? –
我不記得Lenar,對不起。我想我刪除了那些沒有通過'pip'放置的東西 –