I am trying to configure Python2.7 on Ubuntu 10.04 as an alternative package.

I got the Deadsnakes PPA

I set up pip and virtualenv

Now, I am trying to build PyQt (PySide seems to have similar problems in that pip is not supported)

I have activated virtualenv and have downloaded SIP.

(qtenv)~/sip-4.13.3$ python2.7 configure.py

(qtenv)~/sip-4.13.3$ make

gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/include/python2.7 -o siplib.o siplib.c
siplib.c:20:20: error: Python.h: No such file or directory

and of course now there is a cornucopia of errors after that

Supposedly, I would need python-dev for the Python headers but I already have it installed in regular enviroment(python 2.6 on Ubuntu 10.04).

So how do I get the headers file for python2.7 builds?

It seems I am only a few steps away from shaving the yak...

For other readers, a synopsis...

The OP is running Ubuntu 10.4 (which by default uses an older version of Python2.6) but wants Python2.7 and the PyQt package, which depends on the SIP package (from the authors of PyQt.)

The OP has installed and is using virtualenv, which lets you have multiple versions of Python installed.

PyQt is a binding from Python to the Qt C library. Its installation requires compilation against the Python header files (e.g. Python.h which is found e.g. in /usr/local/include/python2.6, or ...2.7)

A standard installation of Ubuntu does not have those Python header files. They can be installed as package python-dev, but they will match the installed version of Python e.g. 2.6.

Evidently the OP has installed python-dev for Python2.6 (and the virtualenv can see it). The OP changed directory to the SIP directory and ran the configure script, but since it was executed by Python2.7, it configured the make scripts for SIP to look for Python2.7 header files. The OP needs to install python-dev package for Python2.7 into their second, virtual, Python environment that is running Python2.7.

(I am also trying to build SIP and PyQt on Ubuntu 12.04 and it is also failing to find /usr/local/include/Python.h. I installed python-dev which installed to /usr/include/python2.7. Maybe the configure script for PyQt is flawed. This is a common problem on Linux, that there is no absolutely standard place to install things, especially when multiple versions of a thing might be installed.)

1 Answer 1


You need the python2.7-dev package from the same PPA. Header files foo a package foo are generally in foo-dev.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .