导入错误:没有命名为numpy的模块

时间:2020-12-14 18:10:22

I have a very similar question to this question, but still one step behind. I have only one version of Python 3 installed on my Windows 7 (sorry) 64-bit system.

我有一个和这个问题很相似的问题,但是仍然落后一步。我只有一个版本的Python 3安装在我的Windows 7(抱歉)64位系统上。

I installed numpy following this link - as suggested in the question. The installation went fine but when I execute

我在这个链接后面安装了numpy,这是问题中的建议。安装进行得很顺利,但当我执行时

import numpy

I got the following error:

我得到以下错误:

Import error: No module named numpy

导入错误:没有命名为numpy的模块

I know this is probably a super basic question, but I'm still learning.

我知道这可能是一个非常基本的问题,但我还在学习。

Thanks

谢谢

13 个解决方案

#1


30  

Support for Python 3 was added in NumPy version 1.5.0, so to begin with, you must download/install a newer version of NumPy.

在NumPy版本1.5.0中添加了对Python 3的支持,所以首先,您必须下载/安装更新的NumPy版本。

#2


117  

You can simply use

你可以简单地使用

pip install numpy

Or for python3, use

或python3,使用

pip3 install numpy

#3


14  

I think there are something wrong with the installation of numpy. Here are my steps to solve this problem.

我认为numpy的安装有问题。下面是我解决这个问题的步骤。

  1. go to this website to download correct package: http://sourceforge.net/projects/numpy/files/
  2. 到这个网站下载正确的软件包:http://sourceforge.net/projects/numpy/files/
  3. unzip the package
  4. 解压缩包
  5. go to the document
  6. 去看文档
  7. use this command to install numpy: python setup.py install
  8. 使用此命令安装numpy: python设置。py安装

#4


6  

You installed the Numpy Version for Python 2.6 - so you can only use it with Python 2.6. You have to install Numpy for Python 3.x, e.g. that one: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-win32-superpack-python3.2.exe/download

您为Python 2.6安装了Numpy版本——因此只能在Python 2.6中使用它。您必须为Python 3安装Numpy。例如:http://sourceforge.net/projects/numpy/files/numpy/1.6.1 /numpy-1.6.1- win6.2 -superpack-python3.2.exe/download

For an overview of the different versions, see here: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/

有关不同版本的概述,请参见这里:http://sourceforge.net/projects/numpy/files/numpy/numpy/1.6.1 /

#5


5  

I also had this problem (Import Error: No module named numpy) but in my case it was a problem with my PATH variables in Mac OS X. I had made an earlier edit to my .bash_profile file that caused the paths for my Anaconda installation (and others) to not be added properly.

我也有这个问题(导入错误:没有模块命名numpy),但就我而言这是一个问题,我的路径变量在Mac OS x我之前做了一个编辑. bash_profile文件导致路径为我的蟒蛇安装(和其他人)不能正常添加。

Just adding this comment to the list here in case other people like me come to this page with the same error message and have the same problem as I had.

只要把这个注释添加到这里的列表中,以防像我这样的人带着同样的错误信息来到这个页面,并且遇到和我一样的问题。

#6


4  

I had this problem too after I installed Numpy. I solved it by just closing the Python interpreter and reopening. It may be something else to try if anyone else has this problem, perhaps it will save a few minutes!

我在安装Numpy之后也遇到了这个问题。我通过关闭Python解释器并重新打开来解决这个问题。如果其他人有这个问题,也许可以尝试别的方法,也许可以节省几分钟!

#7


4  

1)Please install numpy via command prompt (in windows) 2)navigate to scripts folder and type below command

1)请通过命令提示符(在windows中)安装numpy 2)导航到scripts文件夹并在命令下面键入

C:\Python27\Scripts>pip install numpy

C:\ > pip安装numpy Python27 \脚本

installation starts as below: Collecting numpy Downloading numpy-1.13.3-2-cp27-none-win32.whl (6.7MB) 100% |################################| 6.7MB 112kB/s Installing collected packages: numpy Successfully installed numpy-1.13.3

安装开始如下:收集numpy下载numpy-1.13.3-2-cp27-none-win32。whl(6.7 mb)100% | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | 6.7 mb 112 kb / s安装收集包:numpy numpy-1.13.3安装成功

#8


2  

I'm not sure exactly why I was getting the error, but pip3 uninstall numpy then pip3 install numpy resolved the issue for me.

我不知道为什么会出现错误,但是pip3卸载numpy,然后pip3安装numpy解决了这个问题。

#9


1  

For installing NumPy via Anaconda(use below commands):

通过Anaconda安装NumPy(使用以下命令):

  • conda install -c conda-forge numpy
  • conda安装-c conda-forge numpy
  • conda install -c conda-forge/label/broken numpy
  • conda安装-c conda-forge/label/损坏的numpy。

#10


0  

this is the problem of the numpy's version, please check out $CAFFE_ROOT/python/requirement.txt. Then exec: sudo apt-get install python-numpy>=x.x.x, this problem will be sloved.

这是numpy版本的问题,请查看$ coffee _root /python/requirement.txt。然后执行:sudo apt-get install python-numpy>=x.x。这个问题会被解决的。

#11


0  

I too faced the above problem with phyton 3 while setting up python for machine learning.

在为机器学习设置python时,我也遇到了上面的问题。

I followed the below steps :-

我遵循以下步骤:-

Install python-2.7.13.msi

安装python-2.7.13.msi

• set PATH=C:\Python27

•设置路径= C:\ Python27

• set PATH=C:\Python27\Scripts

•设置路径= C:\ Python27 \脚本

Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

去http://www.lfd.uci.edu/ gohlke pythonlibs / # scipy

Downloaded:- -- numpy-1.13.1+mkl-cp27-cp27m-win32.whl

下载:————numpy-1.13.1 + mkl-cp27-cp27m-win32.whl

          --scipy-0.18.0-cp27-cp27m-win32.whl 

Installing numpy: pip install numpy-1.13.1+mkl-cp27-cp27m-win32.whl

安装numpy: pip安装numpy-1.13.1+mkl-cp27-cp27 -win32.whl

Installing scipy: pip install scipy-0.18.0-cp27-cp27m-win32.whl

安装scipy: pip安装scipy-0.18.0-cp27-cp27m-win32.whl

You can test the correctness using below cmds:-

您可以使用以下cmds:-来测试正确性

>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>

#12


0  

Those who are using xonsh, do xpip install numpy.

那些使用xonsh的人,会做xpip安装numpy。

#13


-4  

pip install numpy scipy pandas might work

pip安装麻木的scipy熊猫可能会工作

#1


30  

Support for Python 3 was added in NumPy version 1.5.0, so to begin with, you must download/install a newer version of NumPy.

在NumPy版本1.5.0中添加了对Python 3的支持,所以首先,您必须下载/安装更新的NumPy版本。

#2


117  

You can simply use

你可以简单地使用

pip install numpy

Or for python3, use

或python3,使用

pip3 install numpy

#3


14  

I think there are something wrong with the installation of numpy. Here are my steps to solve this problem.

我认为numpy的安装有问题。下面是我解决这个问题的步骤。

  1. go to this website to download correct package: http://sourceforge.net/projects/numpy/files/
  2. 到这个网站下载正确的软件包:http://sourceforge.net/projects/numpy/files/
  3. unzip the package
  4. 解压缩包
  5. go to the document
  6. 去看文档
  7. use this command to install numpy: python setup.py install
  8. 使用此命令安装numpy: python设置。py安装

#4


6  

You installed the Numpy Version for Python 2.6 - so you can only use it with Python 2.6. You have to install Numpy for Python 3.x, e.g. that one: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-win32-superpack-python3.2.exe/download

您为Python 2.6安装了Numpy版本——因此只能在Python 2.6中使用它。您必须为Python 3安装Numpy。例如:http://sourceforge.net/projects/numpy/files/numpy/1.6.1 /numpy-1.6.1- win6.2 -superpack-python3.2.exe/download

For an overview of the different versions, see here: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/

有关不同版本的概述,请参见这里:http://sourceforge.net/projects/numpy/files/numpy/numpy/1.6.1 /

#5


5  

I also had this problem (Import Error: No module named numpy) but in my case it was a problem with my PATH variables in Mac OS X. I had made an earlier edit to my .bash_profile file that caused the paths for my Anaconda installation (and others) to not be added properly.

我也有这个问题(导入错误:没有模块命名numpy),但就我而言这是一个问题,我的路径变量在Mac OS x我之前做了一个编辑. bash_profile文件导致路径为我的蟒蛇安装(和其他人)不能正常添加。

Just adding this comment to the list here in case other people like me come to this page with the same error message and have the same problem as I had.

只要把这个注释添加到这里的列表中,以防像我这样的人带着同样的错误信息来到这个页面,并且遇到和我一样的问题。

#6


4  

I had this problem too after I installed Numpy. I solved it by just closing the Python interpreter and reopening. It may be something else to try if anyone else has this problem, perhaps it will save a few minutes!

我在安装Numpy之后也遇到了这个问题。我通过关闭Python解释器并重新打开来解决这个问题。如果其他人有这个问题,也许可以尝试别的方法,也许可以节省几分钟!

#7


4  

1)Please install numpy via command prompt (in windows) 2)navigate to scripts folder and type below command

1)请通过命令提示符(在windows中)安装numpy 2)导航到scripts文件夹并在命令下面键入

C:\Python27\Scripts>pip install numpy

C:\ > pip安装numpy Python27 \脚本

installation starts as below: Collecting numpy Downloading numpy-1.13.3-2-cp27-none-win32.whl (6.7MB) 100% |################################| 6.7MB 112kB/s Installing collected packages: numpy Successfully installed numpy-1.13.3

安装开始如下:收集numpy下载numpy-1.13.3-2-cp27-none-win32。whl(6.7 mb)100% | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | 6.7 mb 112 kb / s安装收集包:numpy numpy-1.13.3安装成功

#8


2  

I'm not sure exactly why I was getting the error, but pip3 uninstall numpy then pip3 install numpy resolved the issue for me.

我不知道为什么会出现错误,但是pip3卸载numpy,然后pip3安装numpy解决了这个问题。

#9


1  

For installing NumPy via Anaconda(use below commands):

通过Anaconda安装NumPy(使用以下命令):

  • conda install -c conda-forge numpy
  • conda安装-c conda-forge numpy
  • conda install -c conda-forge/label/broken numpy
  • conda安装-c conda-forge/label/损坏的numpy。

#10


0  

this is the problem of the numpy's version, please check out $CAFFE_ROOT/python/requirement.txt. Then exec: sudo apt-get install python-numpy>=x.x.x, this problem will be sloved.

这是numpy版本的问题,请查看$ coffee _root /python/requirement.txt。然后执行:sudo apt-get install python-numpy>=x.x。这个问题会被解决的。

#11


0  

I too faced the above problem with phyton 3 while setting up python for machine learning.

在为机器学习设置python时,我也遇到了上面的问题。

I followed the below steps :-

我遵循以下步骤:-

Install python-2.7.13.msi

安装python-2.7.13.msi

• set PATH=C:\Python27

•设置路径= C:\ Python27

• set PATH=C:\Python27\Scripts

•设置路径= C:\ Python27 \脚本

Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

去http://www.lfd.uci.edu/ gohlke pythonlibs / # scipy

Downloaded:- -- numpy-1.13.1+mkl-cp27-cp27m-win32.whl

下载:————numpy-1.13.1 + mkl-cp27-cp27m-win32.whl

          --scipy-0.18.0-cp27-cp27m-win32.whl 

Installing numpy: pip install numpy-1.13.1+mkl-cp27-cp27m-win32.whl

安装numpy: pip安装numpy-1.13.1+mkl-cp27-cp27 -win32.whl

Installing scipy: pip install scipy-0.18.0-cp27-cp27m-win32.whl

安装scipy: pip安装scipy-0.18.0-cp27-cp27m-win32.whl

You can test the correctness using below cmds:-

您可以使用以下cmds:-来测试正确性

>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>

#12


0  

Those who are using xonsh, do xpip install numpy.

那些使用xonsh的人,会做xpip安装numpy。

#13


-4  

pip install numpy scipy pandas might work

pip安装麻木的scipy熊猫可能会工作