Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working on a project requiring me to extend Python with a C library, and I will be using SWIG on Ubuntu. Worth noting is that I'm doing this on a computer at my university, and I don't have access to su or sudo commands. In order to generate a wrapper file I enter

gcc -fpic -c output_test.c interface_wrap.c \ -I/usr/bin/Python2.7

This line works perfectly when setting up PyDev on Eclipse, but doesn't work here, which, as far as I can tell from googling the problem, can be solved by installing python-dev. So I downloaded python-dev, v. 2.7.3 for ubuntu and unpacked it. I have been unable to find any guide whatsoever that describes a manual installation of python-dev, so I'm pretty much stuck here. After the unpacking, then what? Looking at the unpacked folders, I am able to find that there are two files in the ~/python-dev/usr/bin-folder:

  • python-config
  • python2-config

Neither is executable. In fact, Ubuntu treats them as broken links. So what am I supposed to do at this point? And why is there such a lack of a comprehensible guides for installing this?

share|improve this question
What do you mean by "unpacking"? Did you try sudo apt-get install python-dev ? – errikos Oct 8 '13 at 15:23
@errokis: He/she isn't allowed to use sudo – Florian Diesch Oct 8 '13 at 15:32
@FlorianDiesch: I supposed "here" referred to his/her computer. – errikos Oct 8 '13 at 15:34

You need some more packages. This should get you all you need (I didn't try to compile anything with it):

apt-get download libpython2.7-dev libpython-dev python2.7-dev python-dev

(you don't need sudo for that).

Now unpack the downloaded .deb files into ~/python-dev (this assumes you don't have any other .deb files in your current working directory):

for i in *.deb; do dpkg -x "$i" ~/python-dev; done

Now everything should be in your ~/python-dev/usr/ tree.

share|improve this answer
He should also define to python where to look for the libraries and headers ;) – Braiam Oct 15 '13 at 14:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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