无法卸载numpy,

时间:2018-05-21 23:09:17

标签: python python-3.x python-2.7 numpy pip

我正在尝试使用pip卸载numpy(我还安装了pandas,但我似乎已经能够卸载它了)。在'numpy的情况下,我得到以下输出。

pip3 uninstall numpy -vvv --log pip.txt

Uninstalling numpy-1.12.1:
  /usr/lib64/python3.6/site-packages/numpy
  /usr/lib64/python3.6/site-packages/numpy-1.12.1-py3.6.egg-info
  Removing file or directory /usr/lib64/python3.6/site-packages/numpy
Exception:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/lib64/python3.6/site-packages/numpy' -> '/tmp/pip-odkg0wo0-uninstall/usr/lib64/python3.6/site-packages/numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/uninstall.py", line 76, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 346, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib64/python3.6/shutil.py", line 556, in move
    rmtree(src)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'multiarray_tests.cpython-36m-x86_64-linux-gnu.so'

我有一个运行Python 2.7.15和Python 3.6.5的Fedora 26系统

我是Python的新手(刚刚开始学习它),所以请原谅无知。我已经看到了几个相关的问题(主要是处理pip安装而不是卸载。他们似乎都没有解决这个问题。我还应该注意到我在其他帖子中读过,运行pip作为sudo是一个坏主意(某些东西)我在尝试安装大熊猫时做了,因为我没有权限(同样,我稍后会读到这是一个坏主意)。感谢任何帮助。

4 个答案:

答案 0 :(得分:0)

尝试将PyCharm社区作为一个ide。他们有一种简单的方法来安装和卸载软件包。您还可以查看管理当前在虚拟环境中安装的所有软件包。

答案 1 :(得分:0)

尝试以root授权运行它

    sudo pip3 uninstall numpy

大多数情况下,它应该可以工作。

答案 2 :(得分:0)

我对numpy有类似的问题,我只需要使用apt(在您的情况下为yum)中删除软件包。 尝试做:
sudo yum remove python3-numpy

答案 3 :(得分:0)

这可能是一个解决方案:

对于python3:

sudo pip3 uninstall numpy  # pip3

对于python:

sudo pip uninstall numpy

或使用:

sudo apt-get remove python-numpy

我希望这会有所帮助。