簡體   English   中英

ImportError:沒有名為“ numpy”的模塊,但它在那里! python 3.5

[英]ImportError: No module named 'numpy' but it's there! python 3.5

我在這里想念什么? 有人可以在這里啟發我嗎?

步驟1.我正在嘗試安裝numpy。

aerin @ aerin-HP-Z230-塔式工作站:〜$ sudo pip install numpy

>     The directory '/home/aerin/.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/aerin/.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.
>     Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages
>     You are using pip version 9.0.3, however version 10.0.1 is available.
>     You should consider upgrading via the 'pip install --upgrade pip' command.

第2步。 它說它在/usr/local/lib/python3.5/dist-packages 因此,讓我們使用numpy。

aerin@aerin-HP-Z230-Tower-Workstation:~$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.

>import numpy

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'

步驟3.您在開玩笑嗎? 讓我們看看它在哪里導入軟件包。

>import site; site.getsitepackages()

['/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.5/dist-packages']

您說它在那里,但它給了我一個ImportError! 如果有人提示我去哪里看,我將不勝感激。 謝謝!

不確定,但我認為您應該嘗試:

sudo pip3 install numpy

如果這不起作用,請嘗試為python2&3重新安裝numpy

嘗試升級pip,然后重新安裝numpy

sudo pip install --upgrade pip
sudo pip install --reinstall numpy

暫無
暫無

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

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