Created
March 29, 2012 16:40
-
-
Save tilgovi/2239638 to your computer and use it in GitHub Desktop.
virtualenv lifting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| If a virtual environment is active, make sure it's being used. | |
| Globally-installed console scripts use an absolute shebang path which | |
| prevents them from importing packages in the virtualenv. | |
| """ | |
| import os | |
| import os.path | |
| if 'VIRTUAL_ENV' in os.environ: | |
| env = os.environ['VIRTUAL_ENV'] | |
| activate = os.path.join(env, 'bin', 'activate_this.py') | |
| execfile(activate, dict(__file__=activate)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment