I'm trying to compile a software package but it fails with

g++ -Wall -O0 -fno-strict-aliasing -I/usr/include/python2.6 -I/usr/include/python2.5  -g -pthread -fpic  -I../../plot/src -I../../math/src -I../../rclib/src/util -I../../rclib/src/conui -I../../rclib/src/io -I../../_general -I../../clop/src -I../../clop/src/real -I../../clop/src/artificial -I../../clop/src/math -DPTHREADS -DGUI=nogui -Drestrict=__restrict__ -DKBHIT_UNIX -DCLOCK_FTIME -c -o ../swig/clop_swig_wrap.o ../swig/clop_swig_wrap.cxx
../swig/clop_swig_wrap.cxx:149:20: fatal error: Python.h: No such file or directory
compilation terminated.
make: *** [../swig/clop_swig_wrap.o] Error 1

Since Python 2.6 is no longer available in synaptic, I downloaded, built, and installed it from http://www.python.org/download/releases/2.6.8/ , but it didn't add the 2.6 libraries to /usr/include

How do I get the python2.6 libraries into /usr/include on Ubuntu 12.04?

  • Where did it put the libs? You can almost certainly copy them to /usr/include (or re-write the source code with the proper path in -I ...)
    – Panther
    Apr 9, 2013 at 17:09
  • If it is not in /usr/include/python2.6 i think you don not have installed it probably. the commands are ./configure, make and than sudo make install.
    – Thomas15v
    Apr 9, 2013 at 17:12
  • I don't know. I just ran sudo apt-get install so it put them wherever it put them (but not in /usr/include/python2.6 where I need it to put them)
    – dspyz
    Apr 9, 2013 at 17:13

2 Answers 2


I figured it out.

sudo make install

installs python header files to /usr/local/include/python2.6, but CLOP was searching for the files in /usr/include/python2.6

I copied them over and there was no more trouble

  1. First download the source code.
  2. Open up a terminal and cd to your download dir cd Downloads (or just Dow and tab ;)).
  3. tar -xvf Python-2.6.8.tar.bz2
  4. cd Python-2.6.8.tar.bz2
  5. ./configure (and check if everything is configured correctly)
  6. make
  7. sudo make install
  8. sudo cp -r /usr/local/include/python2.6 /usr/include/python2.6 and for solving your problem ;)

And you are done ;).

EDIT: /usr/local/include/python2.6 contains pyconfig.h whereas ./Include does not

  • Why copying over files if you can change the search path in your compiler options? It's meant to search in /usr/local paths if this is not a package installation. Please don't make this a habit.
    – gertvdijk
    Apr 9, 2013 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.