簡體   English   中英

ModuleNotFoundError:python 3.9 中沒有名為“scipy”的模塊

[英]ModuleNotFoundError: No module named 'scipy' in python 3.9

我在 ubuntu 18.04 上運行 python3.9。 我已經繼續運行命令sudo apt-get install python-scipy並收到消息:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version (0.19.1-2ubuntu1).
The following packages were automatically installed and are no longer required:
  linux-hwe-5.4-headers-5.4.0-42 linux-hwe-5.4-headers-5.4.0-53
  linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58
  linux-hwe-5.4-headers-5.4.0-59 linux-hwe-5.4-headers-5.4.0-60
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.

然而,當我嘗試運行使用from scipy import integrate的 python3.9 代碼時,我收到錯誤消息:

ModuleNotFoundError: No module named 'scipy'

我已經閱讀了這篇文章並嘗試使用卸載和安裝 scipy

sudo apt-get install python3-scipy

但這沒有用。 有什么建議么?

編輯 1 :我嘗試了sudo pip3 install scipy產生的消息:

The directory '/home/nick/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/nick/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

然而,當我再次嘗試運行代碼時,我仍然得到相同的ImportError

也許試試

python3.9 -m pip install scipy --user

這將使用 python3.9 的 pip 將 package 安裝到沒有 sudo 權限的地方

使用 pipwin

pip install pipwin

下載后

pipwin install scipy

嘗試pip3 install scipy ,如果返回ERRNO 13: access denied然后嘗試pip3 install scipy --user

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM