我上網查了一下,但他們都建議使用我用過的 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用戶,我通常使用自製程式來安裝,所以我對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