Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

is there a shared location for all python interpreters? I want to install a module so it becomes avaiable to all interpreters (2.6, 2.7, 3.1).

Thanks you in advance,

share|improve this question
up vote 1 down vote accepted

All the interpreters first look if there's an environment variable $PYTHONPATH set, which contains directories separated by :.

  • To add a directory to it, type

    export PYTHONPATH="$PYTHONPATH:/home/stefano/my_modules"

Everything in this directory will now be available to all of your python interpreters. Non-existent directories are ignored without an error.

If you're happy with the settings, make the change permanent by appending the export command to the .bashrc file (or any other startup file you like in your home directory.

See also:

Note: the above syntax means that the variable PYTHONPATH will contain itself and the new path, you could also remove the $PYTHONPATH: part to just set one directory. Normally, this variable will be empty on your system, it makes sense to check if there's anything in it: echo $PYTHONPATH.

share|improve this answer
Thank you. It was exactly what I was searching for. – rubik Feb 12 '11 at 15:01

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.