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 tried the two common methods:

import sys
sys.path.append('foo/bar')

AND

export PYTHONPATH=$PYTHONPATH:foo/bar

The first one terminates the appendage once interpreter is exited. The second terminates when terminal is closed (despite the fact that people seem to have no problem with permanently appending via the second method).

What am I missing here and how do I resolve this issue?

share|improve this question

1 Answer 1

You need to put

foo/bar

In a file inside etc/paths.d.

here is a good explanation

EDIT: I think I miss understood, you want to set the PYTHONPATH environment variable. this link show many places that you could put you export statement so it would be permanent.

Put

export PYTHONPATH=$PYTHONPATH:foo/bar

In ~/.bashrc and it will be set every time bash starts.

share|improve this answer
    
can you please explain how exactly I can do this in the terminal? I am a beginner. –  Paul Sep 8 '12 at 17:56
    
'vi ~/.bashrc' then type 'i' to start inserting. Type the export line. Hit escape, colen, wq. That will save the file. Restart the terminal. You can check if it worked by typing 'echo $PYTHONPATH' –  JoshRagem Sep 9 '12 at 3:17

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.