Created
August 4, 2020 19:39
-
-
Save kbfreder/f5747b7b0e2187bfe8b0cb0da36a46eb to your computer and use it in GitHub Desktop.
after you make a virtualenv --relocatable, you need this file
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
!#python | |
""" | |
After you make a virtualenv relocatable (https://pypi.org/project/virtualenv/1.3.3/#making-environments-relocatable), pip will execute a file called 'activate_this.py' in <ENV_NAME>/bin if you go to install another module. In Python3 (? not sure of the cause), this file doesn't get created, so you have to make it. Through trial & error (no copy-and-paste correct answer was out there), I got this code to work. | |
""" | |
import os | |
activator = <path to activate_this.py> # ex: '/home/kfrederick/repos/domain_twists/env/bin/activate_this.py' | |
virtual_env = <path to virutal env> # ex: '/home/kfrederick/repos/domain_twists/env' | |
os.environ['PATH'] = os.pathsep.join([ | |
os.path.join(virtual_env, 'bin'), | |
os.getenv('PATH', '')]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After you make a virtualenv relocatable (https://pypi.org/project/virtualenv/1.3.3/#making-environments-relocatable), pip will execute a file called 'activate_this.py' in <ENV_NAME>/bin if you go to install another module. In Python3 (? not sure of the cause), this file doesn't get created, so you have to make it. Through trial & error (no copy-and-paste correct answer was out there), I got this code to work.