Installing NumPy via Anaconda in Windows

前端 未结 5 2014
一生所求
一生所求 2020-12-05 20:01

I am trying to use Numpy in a Python 2.7.8 script in Windows. So, I download and installed the latest version of Anaconda (I also want to use some of the other tools in Anac

相关标签:
5条回答
  • 2020-12-05 20:04

    I had the same problem, getting the message "ImportError: No module named numpy".

    I'm also using anaconda and found out that I needed to add numpy to the ENV I was using. You can check the packages you have in your environment with the command:

    conda list

    So, when I used that command, numpy was not displayed. If that is your case, you just have to add it, with the command:

    conda install numpy

    After I did that, the error with the import numpy was gone

    0 讨论(0)
  • 2020-12-05 20:10

    Yep you should start anaconda's python in order to use python libs which come with anaconda. Or otherwise you have to manually add anaconda\lib to pythonpath which is less trivial. You can start anaconda's python by a full path:

    path\to\anaconda\python.exe
    

    or you can run the following two commands as an admin in cmd to make windows pipe every .py file to anaconda's python:

    assoc .py=Python.File
    ftype Python.File=C:\path\to\Anaconda\python.exe "%1" %*
    

    after this you'll be able just to call python scripts without specifying the python executable at all.

    0 讨论(0)
  • 2020-12-05 20:20

    The above answers seem to resolve the issue. If it doesn't, then you may also try to update conda using the following command.

    conda update conda
    

    And then try to install numpy using

    conda install numpy
    
    0 讨论(0)
  • 2020-12-05 20:22

    Anaconda folder basically resides in C:\Users\\Anaconda. Try setting the PATH to this folder.

    0 讨论(0)
  • 2020-12-05 20:26

    Move path\to\anaconda in the PATH above path\to\python

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