简体   繁体   English

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

[英]Not able to install/uninstall packages using python pip

When I tried to install or uninstall packages using pip(with or without using sudo), I am getting Exception. 当我尝试使用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'

My OS is MacOS Sierra. 我的操作系统是MacOS Sierra。 I have tried to uninstall and install pip, but the problem still exists. 我尝试卸载并安装pip,但问题仍然存在。 Please help. 请帮忙。

Ok, your questions seems to be missing some vital information for it does not state the exact command you use to try and install a python module using pip. 好的,您的问题似乎缺少一些重要信息,因为它没有说明您尝试使用pip安装python模块的确切命令。 Please always try to provide a minimal, complete, and verifiable example . 请始终尝试提供一个最小,完整和可验证的示例

If I'd have to take a guess by the error-code however, I would guess you are facing a permission/rights issue rather then a pip-issue. 但是,如果我必须通过错误代码来猜测,我想您将面临许可/权利问题,而不是点子问题。 I see 2 clues that make me suspect such a thing. 我看到2条线索让我怀疑这件事。 For 1: [Errno 1] usually means there is a permission error and 2: you mention in your comments that you installed packages using --user , but did you use that when trying to uninstall them as well? 对于1: [Errno 1]通常表示存在权限错误,而2:在注释中提到使用--user安装了软件包,但是在尝试卸载它们时是否也使用了?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM