可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
I installed numpy following this link - as suggested in the question. The installation went fine but when I execute
import numpy
I got the following error:
Import error: No module named numpy
I know this is probably a super basic question, but I'm still learning.
Thanks
回答1:
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.
回答2:
You can simply use
pip install numpy
Or for python3, use
pip3 install numpy
回答3:
I think there are something wrong with the installation of numpy.
Here are my steps to solve this problem.
- go to this website to download correct package: http://sourceforge.net/projects/numpy/files/
- unzip the package
- go to the document
- use this command to install numpy:
python setup.py install
回答4:
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.
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.
回答5:
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
For an overview of the different versions, see here: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/
回答6:
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!
回答7:
1)Please install numpy via command prompt (in windows)
2)navigate to scripts folder and type below command
C:\Python27\Scripts>pip install numpy
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
回答8:
I'm not sure exactly why I was getting the error, but pip3 uninstall numpy
then pip3 install numpy
resolved the issue for me.
回答9:
For installing NumPy via Anaconda(use below commands):
- conda install -c conda-forge numpy
- conda install -c conda-forge/label/broken numpy
回答10:
I too faced the above problem with phyton 3 while setting up python for machine learning.
I followed the below steps :-
Install python-2.7.13.msi
• set PATH=C:\Python27
• set PATH=C:\Python27\Scripts
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Downloaded:- -- 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
Installing scipy:
pip install scipy-0.18.0-cp27-cp27m-win32.whl
You can test the correctness using below cmds:-
>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>
回答11:
Those who are using xonsh
, do xpip install numpy
.
回答12:
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.
回答13:
import numpy as np
ImportError: No module named numpy
I got this even though I knew numpy was installed and unsuccessfully tried all the advice above. The fix for me was to remove the as np and directly refer to modules . (python 3.4.8 on Centos)
.
import numpy
DataTwo=numpy.stack((OutputListUnixTwo))...
回答14:
After trying many suggestions from various sites and similar questions, what worked for me was to uninstall all Python stuff and reinstall Anaconda only (see https://stackoverflow.com/a/38330088/1083292)
The previous Python installation I had was not only redundant but only caused me trouble.
回答15:
I had numpy installed on the same environment both by pip and by conda, and simply removing and reinstalling either was not enough.
I had to reinstall both.
I don't know why it suddenly happened, but the solution was
pip uninstall numpy
conda uninstall numpy
uninstalling from conda also removed torch
and torchvision
.
then
conda install pytorch-cpu torchvision-cpu -c pytorch
and
pip install numpy
this resolved the issue for me.
回答16:
pip install numpy scipy pandas might work