当我尝试使用 pip(有或不使用 sudo(安装或卸载软件包时,我遇到了异常。
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/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
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 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-gpvJsN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
我的操作系统是MacOS Sierra。我已尝试卸载并安装 pip,但问题仍然存在。请帮忙。
好的,您的问题似乎缺少一些重要信息,因为它没有说明您用于尝试使用 pip 安装 python 模块的确切命令。请始终尝试提供一个最小、完整且可验证的示例。
但是,如果我必须通过错误代码进行猜测,我会猜您面临许可/权利问题而不是pip问题。我看到 2 条线索让我怀疑这样的事情。对于 1:[Errno 1]
通常意味着存在权限错误和 2:您在评论中提到您使用 --user
安装了软件包,但是您在尝试卸载它们时也使用它吗?