Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
print(sys.path)

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
add comment

Your Answer

 
discard

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.