Import Error: No module named numpy

前端 未结 24 2299
名媛妹妹
名媛妹妹 2020-11-28 01:53

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.

相关标签:
24条回答
  • 2020-11-28 02:31

    You should try to install numpy using one of those:

    pip install numpy
    pip2 install numpy
    pip3 install numpy
    

    For some reason in my case pip2 solved the problem

    0 讨论(0)
  • 2020-11-28 02:31

    If it was working before reinstalling python would solve the issue.

    I just hit and resolved this issue using: How can I install a previous version of Python 3 in macOS using homebrew?

    0 讨论(0)
  • 2020-11-28 02:33
    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))...
    
    0 讨论(0)
  • 2020-11-28 02:34

    For me, on windows 10, I had unknowingly installed multiple python versions (One from PyCharm IDE and another from Windows store). I uninstalled the one from windows Store and just to be thorough, uninstalled numpy pip uninstall numpy and then installed it again pip install numpy. It worked in the terminal in PyCharm and also in command prompt.

    0 讨论(0)
  • 2020-11-28 02:36

    For those using python 2.7, should try:

    apt-get install -y python-numpy
    

    Instead of pip install numpy

    0 讨论(0)
  • 2020-11-28 02:39

    As stated in other answers, this error may refer to using the wrong python version. In my case, my environment is Windows 10 + Cygwin. In my Windows environment variables, the PATH points to C:\Python38 which is correct, but when I run my command like this:

    ./my_script.py
    

    I got the ImportError: No module named numpy because the version used in this case is Cygwin's own Python version even if PATH environment variable is correct. All I needed was to run the script like this:

    py my_script.py
    

    And this way the problem was solved.

    0 讨论(0)
提交回复
热议问题