14

I am trying to install numpy from http://www.scipy.org/Download .

by git clone git://github.com/numpy/numpy.git numpy

But, when I ran python setup.py install

I got:

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel

Where to get python-dev ?

I tried:

$ easy_install python-devel
Searching for python-devel
Reading http://pypi.python.org/simple/python-devel/
Couldn't find index page for 'python-devel' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for python-devel
error: Could not find suitable distribution for Requirement.parse('python-devel')

and

$ easy_install python-dev
Searching for python-dev
Reading http://pypi.python.org/simple/python-dev/
Couldn't find index page for 'python-dev' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for python-dev
error: Could not find suitable distribution for Requirement.parse('python-dev')

Any help will be appreciated.

In order to solve the problem of python-dev, I have installed python2.6 in my local dir.

But, when I used python setup.py install --user to install numpy ,

I got:

$ python setup.py install --user

'import site' failed;

use -v for traceback Traceback (most recent call last): File "setup.py", line 18,

in import os ImportError:

No module named os

in python2.6

I got: >>> import os Traceback (most recent call last): File "", line 1, in ImportError: No module named os

Any help will be appreciated. thanks

The following links are not helpful because I do not have root right and cannot use sudo.

example1

example2

Community
  • 1
  • 1
runner frank
  • 331
  • 1
  • 6
  • 13

3 Answers3

15

If you are in Ubuntu(e.g. Ubuntu 12.04), it is very easy,

sudo apt-get install python-numpy

or you can compile from source through pip(I think on RedHat almost the same):

sudo apt-get install python-dev  
sudo apt-get install python-pip  
pip install numpy
Honghe.Wu
  • 5,899
  • 6
  • 36
  • 47
7

python-dev is not a python module. Actually it's "Header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications." You can install it through Synaptic Package Manager,Software Center or yum.

Kevin
  • 97
  • 2
  • Would you please tell me how to install python-dev by Synaptic Package Manager,Software Center or yum ? I am not a rot use and I cannot use sudo. I have to install it in m y local dir. Any help will be appreciated. – runner frank Oct 25 '12 at 12:45
4

On CentOS, the python development libraries are under the name python-devel, not python-dev.

Use sudo yum install python-devel to install them on your CentOS system.

Gank
  • 4,507
  • 4
  • 49
  • 45