sudo apt-get update
sudo apt-get install python-setuptools python-dev build-essential git-core -y
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
mkdir ~/virtualenvs
echo "export WORKON_HOME=~/virtualenvs" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
echo "export PIP_VIRTUALENV_BASE=~/virtualenvs" >> ~/.bashrc
source ~/.bashrc
mkvirtualenv blog
If you want to get out/off your virtualenv use this command:
deactivate
If you want to jump back on the virtualenv we just created and installed django use this command:
workon xxx
And finally if you want to remove the virtualenv altogether
rmvirtualenv blog
Create a new PyDev Project
File -> New -> PyDev ProjectA window will popup asking about the project details. Alternatively if you have already created a project go to
Project -> PropertiesClick on "Click here to configure an interpreter no listed"
Click the New buttonA new window will popup
Interpreter name: VIRTUALENVNAME (or whatever you like)
Interpreter executable: ~.virtualenvs/VIRTUALENVNAME/bin/python (or your custom location to the virtualenv/bin/python)
This is the best mkvirtualenv tutorial, thank you!
ReplyDeleteHi,
ReplyDeleteJust a little comment: On ubuntu 14.04 the path for virtualenvwrapper.sh must be changed to
"source /etc/bash_completion.d/virtualenvwrapper"