无法在 ubuntu 上卸载 numpy
Posted
技术标签:
【中文标题】无法在 ubuntu 上卸载 numpy【英文标题】:Cannot uninstall numpy on ubuntu 【发布时间】:2021-12-01 04:59:08 【问题描述】:看来我的点子坏了:
ubuntu@ip-x:~$ pip3 uninstall numpy
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Found existing installation: numpy 1.19.5
ERROR: Cannot uninstall numpy 1.19.5, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.19.5'.
ubuntu@ip-x:~$ python3 -m pip uninstall numpy
Found existing installation: numpy 1.19.5
ERROR: Cannot uninstall numpy 1.19.5, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.19.5'.
ubuntu@ip-x:~$ sudo apt remove python3-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python3-numpy' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 71 not upgraded.
ubuntu@ip-172-30-0-42:~$
为什么我无法卸载 numpy?
编辑:不确定是否相关,但我安装了 OpenVINO
EDIT2:我尝试了建议的解决方案,但它不起作用:
ubuntu@ip-x:~$ pip3 install --force-reinstall --no-deps numpy==1.19.5
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting numpy==1.19.5
Downloading numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
|████████████████████████████████| 14.8 MB 6.3 MB/s
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.19.5
ERROR: Cannot uninstall numpy 1.19.5, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.19.5'.
EDIT3:我正在尝试安装,因为我在使用 numpy 时遇到了一些问题。我觉得有不同的版本,比较一下:
pip3 uninstall numpy
Found existing installation: numpy 1.19.5
ERROR: Cannot uninstall numpy 1.19.5, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.19.5'.
与
ubuntu@x:~$ python3 -c "import numpy;print(numpy.__version__);print(numpy.__file__)";
1.18.5
/usr/local/lib/python3.6/dist-packages/numpy/__init__.py
EDIT4:我不能使用numba
:
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting numba
Downloading numba-0.53.1-cp36-cp36m-manylinux2014_x86_64.whl (3.4 MB)
|████████████████████████████████| 3.4 MB 7.9 MB/s
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from numba) (58.1.0)
Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.6/dist-packages (from numba) (1.19.5)
Collecting llvmlite<0.37,>=0.36.0rc1
Downloading llvmlite-0.36.0-cp36-cp36m-manylinux2010_x86_64.whl (25.3 MB)
|████████████████████████████████| 25.3 MB 128.3 MB/s
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/numpy-1.19.5.dist-info/METADATA'
【问题讨论】:
您是否尝试过运行建议的命令? 顺便说一句,为什么你要卸载 numpy? 建议的解决方案给了我同样的错误。 原因见上文。 【参考方案1】:因为你的 numpy 安装要么坏了,要么没有被 pip 处理:
ERROR: Cannot uninstall numpy 1.19.5, RECORD file not found.
要么采用提供的蛮力解决方案,要么追踪 numpy 文件的实际来源——查看您的 PYTHONPATH。
【讨论】:
【参考方案2】:最终的解决方案是直接删除 numpy
rm -rf ~/.local/lib/python/site-packages/numpy
pip install numpy
但首先你应该检查你使用的是哪个 python 并找到你的站点包路径
【讨论】:
目录`~/.local/lib/python3.6/site-packages/numpy`不存在。 尝试检测你的python版本 用户命令“哪个python”/usr/bin/python3
但cd ~/.local/lib/python3
不存在。只有~/.local/lib/python3.6
存在。
所以尝试使用你的路径 - rm -rf ~/.local/lib/python3.6/site-packages/numpy【参考方案3】:
看来我已经解决了:
pip3 install --user --force-reinstall --no-deps numpy==1.19.5
至少这让 numpy 和 numba 正常工作。
【讨论】:
【参考方案4】:-
您可以使用此命令找到已安装的软件包
pip freeze
我推荐你使用virtual enviroment
【讨论】:
thx 我看到有问题的 apt 用法并认为 in 可以是可执行包“numpy” 是的,which numpy
返回numpy not found
。
我改变了命令以上是关于无法在 ubuntu 上卸载 numpy的主要内容,如果未能解决你的问题,请参考以下文章