无法使用python pip安装/卸载软件包

时间:2017-03-24 09:08:39

标签: python pip macos-sierra

当我尝试使用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,但问题仍然存在。请帮忙。

1 个答案:

答案 0 :(得分:0)

好的,您的问题似乎缺少一些重要信息,因为它没有说明您使用pip尝试安装python模块的确切命令。请始终尝试提供minimal, complete, and verifiable example

如果我不得不通过错误代码猜测,我猜你会面临一个权限/权利问题,而不是一个pip问题。我看到2条线索让我怀疑这样的事情。对于1:[Errno 1]通常表示存在权限错误,2:您在评论中提到您使用--user安装了软件包,但是在尝试卸载软件包时是否也使用过它?