我在网上查了一下,但他们都建议使用我使用的 sudo 命令
sudo pip uninstall numpy
我收到此消息:
Not uninstalling numpy at /usr/lib/python2.7/dist-packages, outside environment /usr
我使用 pip 而不是 apt 安装它。
输出:
$ dpkg -S /usr/lib/python2.7/dist-packages/numpy
python-numpy: /usr/lib/python2.7/dist-packages/numpy
PS:我是 Mac 用户,我通常使用 Homebrew 进行安装,所以我对 Ubuntu 还只是个业余爱好者
答案1
根据的输出dpkg -S
,numpy
已经安装使用,apt
要删除它,请运行:
sudo apt remove python-numpy
您可能已经使用 进行了本地安装pip
,要删除它,您可以使用:
pip uninstall numpy --user
答案2
使用--isolated
选项。
如下所示:
sudo pip uninstall numpy --isolated
答案3
只有上述提示有帮助:
sudo apt remove python3-numpy
->
The following packages were automatically installed and are no longer required:
libjs-jquery-ui python-matplotlib-data python3-kiwisolver
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
python3-matplotlib python3-numpy
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 28.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 389330 files and directories currently installed.)
Removing python3-matplotlib (3.1.2-1ubuntu4) ...
Removing python3-numpy (1:1.17.4-5ubuntu3) ...
然后以用户身份重新安装:
pip3 install numpy
答案4
/usr/lib/python3/dist-packages
我通过编辑并手动删除与 numpy 关联的两个目录解决了这个问题。
之后我使用重新安装了软件包
pip install numpy