Python 使用 pip 卸载 numpy 时权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35567511/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 16:36:35  来源:igfitidea点击:

Permission denied when uninstalling numpy with pip

pythonnumpy

提问by okchip

I am trying to uninstall Numpy via Pip but this error comes up:

我正在尝试通过 Pip 卸载 Numpy,但出现此错误:

$ pip uninstall numpy

Uninstalling numpy:
  /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.6.2-py2.7.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/uninstall.py", line 54, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 899, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 495, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1518, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 293, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    os.unlink(src)
 OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.6.2-py2.7.egg-info'

No clue what the best way to proceed from here would be. I would like to uninstall numpy completely then reinstall.

不知道从这里开始的最佳方式是什么。我想完全卸载 numpy 然后重新安装。

回答by Francesco Nazzaro

try:

尝试:

sudo pip uninstall numpy

or, if it doesn't work:

或者,如果它不起作用:

sudo apt-get remove python-numpy

回答by chantal

You need to add sudo, sudo pip uninstall numpy

你需要添加sudo, sudo pip uninstall numpy

回答by Felix Guo

I did try several things, the following update works for me.

我确实尝试了几件事,以下更新对我有用。

sudo easy_install -U numpy