Last active
December 14, 2015 21:09
-
-
Save az7arul/5149300 to your computer and use it in GitHub Desktop.
Creating alias for activating python virtual environments. Add this line to your ~/.bash_profile 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
for i in `ls ~/python-env`;do alias act_${i}="source ~/python-env/${i}/bin/activate";done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All your virtual environment should be in ~/python-env directory. This script will create alias for activating each of the virtual environments so that you do not have to type . ~/python-env/[environmentName]/bin/activate or source ~/pyhon-env/[envName]/bin/activate
Each time your shell starts it will create aliases for all the venv's in the ~/python-env directory.
Usage: act_[environmentName] #=> act_cms
P.S. You will need to run ". ~/bash_profile" to get the aliases ready without restarting the shell for the first time
Limitation: virtual env's cant have spaces in their name