You want to use virtualenv
(or something like it).
$ virtualenv mydev
$ source mydev/bin/activate
This creates a local Python installation in the mydev
directory and modifies several key environment variables to use mydev
instead of the default Python directories.
Now, your PYTHONPATH
looks in mydev
first for any imports, and anything you install (using pip
, setup.py
, etc) will go in mydev
. When you are finished using the mydev
virtual environment, run
$ deactivate
to restore your PYTHONPATH
to its previous value. mydev
remains, so you can always reactivate it later.