Import Error: No module named numpy

前端 未结 24 2296
名媛妹妹
名媛妹妹 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:20

    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/

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

    Those who are using xonsh, do xpip install numpy.

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

    Installing Numpy on Windows

    1. Open Windows command prompt with administrator privileges (quick method: Press the Windows key. Type "cmd". Right-click on the suggested "Command Prompt" and select "Run as Administrator)
    2. Navigate to the Python installation directory's Scripts folder using the "cd" (change directory) command. e.g. "cd C:\Program Files (x86)\PythonXX\Scripts"

    This might be: C:\Users\\AppData\Local\Programs\Python\PythonXX\Scripts or C:\Program Files (x86)\PythonXX\Scripts (where XX represents the Python version number), depending on where it was installed. It may be easier to find the folder using Windows explorer, and then paste or type the address from the Explorer address bar into the command prompt.

    1. Enter the following command: "pip install numpy".

    You should see something similar to the following text appear as the package is downloaded and installed.

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

    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.

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

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

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

    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.

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