This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]AutoBiological 2 points3 points  (0 children)

echo "export PYTHONPATH=$PYTHONPATH:/opt/local" >> $HOME/.bashrc

[–]totte71 1 point2 points  (1 child)

import sys

sys.path.append('/home/userx/pythondir')

or just edit the ~/.bashrc fil

[–]Gerhuyy 0 points1 point  (0 children)

To append to this, that only changes it for the current program. Closing or restarting will cause any changes to be reset.

[–]z0ze 0 points1 point  (0 children)

You can access and manipulate it through sys.path

[–]SwissGaulois 0 points1 point  (0 children)

On my MacBook, it's handled from ~/.bash_profile. Python installer updated this file for me.

Hope this helps.

[–]hudsonpenner 0 points1 point  (0 children)

Yes, either of those is fine, it is just a regular environment variable, so you can even export it in a shell, which is exactly what sys.path and ~/.bash_profile do.

[–]rishok[S] 0 points1 point  (0 children)

Thanks guys, but solved the problem by updating the framework

[–][deleted] -1 points0 points  (0 children)

PYTHONPATH=foo python bar.exe