无法"sudo pip卸载";在OS X El Capitan中不允许进行操作(/tmp) [英] Cannot "sudo pip uninstall" operation not permitted (/tmp) in OS X El Capitan

查看:101
本文介绍了无法"sudo pip卸载";在OS X El Capitan中不允许进行操作(/tmp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前言:我的OS X Python安装是混乱.在开始了解Homebrew之前,我开始使用系统Python方式.因此,我一直以来一直使用sudo pip install.我现在正在尝试清理所有内容,然后使用Homebrew的Python安装/链接pip软件包.

Preface: My OS X Python installation is a mess. I started using the system Python way before I found out about Homebrew. And so I've been using sudo pip install since forever. I'm now trying to clean everything up and then install/link pip packages against Homebrew's Python.

1)在许多SO答案中,人们建议这样做:pip freeze | xargs sudo pip uninstall -y这对我不起作用.我得到了很长的追溯.这些是其中最具代表性的部分:

1) In many SO answers, people suggest doing: pip freeze | xargs sudo pip uninstall -y That doesn't work for me. I get a very long traceback. These are the most representative chunks of it:

~ $ 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包(请记住这一点).

where altgraph is just the first pip package in pip list (keep that in mind).

2)然后按照警告提示尝试了pip freeze | xargs sudo -H pip uninstall -y,但这只是删除了警告.错误消息仍然存在.

2) I then tried pip freeze | xargs sudo -H pip uninstall -y, as the warning suggested, but that simply remove the warning. The error messages persisted.

3)我还尝试创建任何引起投诉的目录(例如~/Library/Caches/pip及其一些父母和孩子).由于某些原因,我无法chown问题最多的目录/tmp:

3) I also tried chown-ing any directories that raised complaints (e.g., ~/Library/Caches/pip and some of its parents and children). For some reason, I cannot chown the most problematic directory, /tmp:

~ $ sudo chown -R ${USER} /tmp
chown: /tmp: Operation not permitted

4)最后,我尝试从列表的 手动卸载软件包,瞧,例如,我可以轻松地执行sudo pip uninstall virtualenv.尝试手动卸载altgraph会导致上述相同错误.

4) Finally, I tried manually uninstalling a package from further down the list and voila, I could easily do sudo pip uninstall virtualenv for example. Attempting to manually uninstall altgraph results in the same error above.

任何想法如何进行?记住,我不在乎任何一个软件包.我只想打点子,然后使用Homebrew的Python从头开始.谢谢!

Any ideas how to proceed? Remember, I don't care about any one package; I just want to nuke pip and start from scratch using Homebrew's Python. Thanks!

更新:

  1. 手动查看列表,bdist-mpkg-0.5.0
  2. 也会发生相同的情况
  3. 另外一些:matplotlibzope.interfacexattrsixscipypytz.
  1. Going down the list manually, the same thing happens with bdist-mpkg-0.5.0
  2. A few more: matplotlib, zope.interface, xattr, six, scipy, pytz.

推荐答案

我很确定brew reinstall python以某种方式解决了我遇到的许多问题.然后,我还必须对/usr/local/lib/python2.7/site-packages

I'm pretty sure that brew reinstall python somehow fixed a bunch of the issues I was having. I then had to also nuke (i.e., rm -rf) a few things in /usr/local/lib/python2.7/site-packages

与我的特定用例(在OS X上安装ROS)相关的问题和答案: https://github.com/mikepurvis/ros-install-osx/issues/11

Issue and answer related to my specific use case (ROS installation on OS X): https://github.com/mikepurvis/ros-install-osx/issues/11

这篇关于无法"sudo pip卸载";在OS X El Capitan中不允许进行操作(/tmp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆