导入错误:没有名为'numpy'的模块,但它就在那里!蟒蛇 3.5



我在这里错过了什么?有人可以在这里启发我吗?

第 1 步。我正在尝试安装 numpy。

aerin@aerin-HP-Z230-塔式工作站:~$ 须藤点安装数字

>     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']

你说它在那里,但它给了我一个导入错误!如果有人提示我去哪里看,我将不胜感激。谢谢!

不确定,但我认为您应该尝试:

sudo pip3 install numpy

如果这不起作用,请尝试为 python2 和 3 重新安装 numpy

尝试升级 pip 并重新安装 numpy

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

相关内容

最新更新