I agree with most of the answers here that changing PYTHONPATH through whatever means is less elegant than adding the package you want through some form of link. However, I think the best way to add such links is through pip install -e /path/to/your/lib
(after activating the virtualenv, of course). This also creates a .egg-link
file in the appropriate site-packages directory, so there is no need for elaborate ways to find the right site-packages
dir. And you do not need any virtualenv-specific tools installed.
As people pointed out above, that is not quite the same as changing PYTHONPATH because that appends to sys.path instead of prepending, but in many scenarios that is irrelevant.