Can't import Numpy in Python

前端 未结 6 1260
盖世英雄少女心
盖世英雄少女心 2020-12-09 16:32

I\'m trying to write some code that uses Numpy. However, I can\'t import it:

Python 2.6.2 (r262, May 15 2009, 10:22:27) 
[GCC 3.4.2] on linux2
Type \"help\"         


        
相关标签:
6条回答
  • 2020-12-09 16:56

    Disabling pyright worked perfectly for me on VS.

    0 讨论(0)
  • 2020-12-09 16:59

    Have you installed it?

    On debian/ubuntu:

    aptitude install python-numpy
    

    On windows:

    http://sourceforge.net/projects/numpy/files/NumPy/

    On other systems:

    http://sourceforge.net/projects/numpy/files/NumPy/

    $ tar xfz numpy-n.m.tar.gz
    $ cd numpy-n.m
    $ python setup.py install
    
    0 讨论(0)
  • 2020-12-09 17:02

    The following command worked for me:

    python.exe -m pip install numpy
    
    0 讨论(0)
  • 2020-12-09 17:07

    To install it on Debian/Ubuntu:

    sudo apt-get install python-numpy
    
    0 讨论(0)
  • 2020-12-09 17:09

    I was trying to import numpy in python 3.2.1 on windows 7.

    Followed suggestions in above answer for numpy-1.6.1.zip as below after unzipping it

    cd numpy-1.6
    python setup.py install
    

    but got an error with a statement as below

    unable to find vcvarsall.bat
    

    For this error I found a related question here which suggested installing mingW. MingW was taking some time to install.

    In the meanwhile tried to install numpy 1.6 again using the direct windows installer available at this link the file name is "numpy-1.6.1-win32-superpack-python3.2.exe"

    Installation went smoothly and now I am able to import numpy without using mingW.

    Long story short try using windows installer for numpy, if one is available.

    0 讨论(0)
  • 2020-12-09 17:19

    Your sys.path is kind of unusual, as each entry is prefixed with /usr/intel. I guess numpy is installed in the usual non-prefixed place, e.g. it. /usr/share/pyshared/numpy on my Ubuntu system.

    Try find / -iname '*numpy*'

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