I know there are multiple solutions online, but some are for windows, some are environmental variable, etc..
What is the best way?
Find your site-packages directory and create a new file called myproj.pth
Inside that file, put each directory you want to add, one per line like so:
/home/myuser/svn-repos/myproject /home/myuser/svn-repos/SomeOtherProject
Python loads *.pth
every time it runs, and imports all paths in each of those files.
In Ubuntu, that directory can often be found at
/usr/local/lib/python2.6/dist-packages/
I personally just define PYTHONPATH
in ~/.bashrc
, as for what's the "best" approach? I think that's hard to answer (or rather, there's no correct answer). It depends.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With