Super User is a question and answer site for computer enthusiasts and power users. 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

I want to install qt4reactor so I went to the github page, it says:

Unpack this directory into your PYTHONPATH

I don't know what that means. I unziped the file and I tried to add the path to PYTHOPNPATH in the .bashrc file like this:

export PYTHONPATH=/home/jacos/qtreactor

But I can't import it whatsoever.

What I want to ask is where exactly is my PYTHONPATH? How can I find that out? What's the right way to do this?

share|improve this question
up vote 1 down vote accepted

First things first, you should really make that export into PYTHONPATH=/home/jacos/qtreactor:$PYTHONPATH so as not to clobber anything that might be in there from system config files, &c, but prepend to it instead - additionally, you don't actually need to start it with "export" there. You'll want to run a new shell or run source ~/.bashrc so that those changes take effect.

The default search path is always appended to $PYTHONPATH, according to my "man python", and you can get a look at it by opening a python shell and running the following:

import sys

That should give you an idea of what paths your python is searching in, and you may then be able to unpack into one of those directories.

As for the Right Way to do this, if qt4reactor should be available to anyone using the computer, stick it somewhere under /usr/lib/python (or better yet, /usr/lib/python[version], since python2.7 and python3 have noticeable differences...) and add that path to the PYTHONPATH of anyone using the machine by assigning it in /etc/bash.bashrc instead of ~/.bashrc. If it should be usable for only you, create a suitable folder in your home-directory and put the qt4reactor under that, so that if you need to add more python modules in the future you won't clutter up your home-folder too much. Obviously you'll need to change your additions to $PYTHONPATH in your ~/.bashrc as well. If you're the only user of this machine, then use whichever method you like - personally I'd go for the one that simulates multi-user machines, but that's because I run other boxen that do have multiple users and I think it's good to maintain good habits.

share|improve this answer
great answer!Many thanks! – Gnijuohz Apr 4 '12 at 1:15

You must log in to answer this question.

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