Created
October 4, 2012 08:02
-
-
Save Answeror/3832085 to your computer and use it in GitHub Desktop.
Activate virtualenv in blender
This file contains 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
def activate_virtualenv(name): | |
"""Activate given virtualenv. | |
Virtualenv home folder is given by environment variable ``WORKON_HOME`` or | |
``~/Envs`. | |
""" | |
if 'WORKON_HOME' in os.environ: | |
home = os.environ['WORKON_HOME'] | |
else: | |
home = os.path.expanduser(os.path.join('~', 'Envs')) | |
filepath = os.path.join(home, name, 'Scripts', 'activate_this.py') | |
with open(filepath, 'r') as f: | |
exec(f.read(), dict(__file__=filepath)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment