Wednesday, May 2, 2018
Mac OSX virtualenv instructions
http://roundhere.net/journal/virtualenv-ubuntu-12-10/
Install pip
sudo apt-get install python-pip
Install virtualenv
sudo pip install virtualenv
Create a dir to store your virtualenvs (I use ~/.virtualenvs)
mkdir ~/.virtualenvs
At this point you are all set to use virtualenv with the standard commands. However, I prefer to use the extra commands included in virtualenvwrapper. Lets set that up.
Install virtualenvwrapper
sudo pip install virtualenvwrapper
Set WORKON_HOME to your virtualenv dir
export WORKON_HOME=~/.virtualenvs
Add virtualenvwrapper.sh to .bashrc
○ → which virtualenvwrapper.sh
/Users//anaconda3/bin/virtualenvwrapper.sh
Add this line to the end of ~/.bashrc so that the virtualenvwrapper commands are loaded.
. /Users//anaconda3/bin/virtualenvwrapper.sh
Exit and re-open your shell, or reload .bashrc with the command . .bashrc and you’re ready to go.
Create a new virtualenv
mkvirtualenv myawesomeproject
to exit your new virtualenv, use deactivate.
Switch between enviornments with workon
To load or switch between virtualenvs, use the workon command:
workon myawesomeproject
You can read more about virtualenv here and virtualenvwrapper here. You might also want to look at this very similar (and probably better) python guide post.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment