Skip to content Skip to sidebar Skip to footer

How To Import Numpy In The Python Shell

I have tried importing NumPy in Python, but it did not succeed: >>> import numpy as np x=np.array([[7,8,5],[3,5,7]],np.int32) Traceback (most recent call last):

Solution 1:

The message is fairly self-explanatory; your working directory should not be the NumPy source directory when you invoke Python; NumPy should be installed and your working directory should be anything but the directory where it lives.

Solution 2:

On Debian/Ubuntu:

aptitude install python-numpy

On Windows, download the installer:

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

On other systems, download the tar.gz and run the following:

$ tar xfz numpy-n.m.tar.gz$ cd numpy-n.m$ python setup.py install

Post a Comment for "How To Import Numpy In The Python Shell"