ReleaseEngineering/Virtualenv: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
mkdir $HOME/venv | mkdir $HOME/venv | ||
cd $HOME/venv | cd $HOME/venv | ||
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1. | wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.8.4.tar.gz | ||
tar zxf virtualenv-1. | tar zxf virtualenv-1.8.4.tar.gz | ||
python virtualenv-1. | python virtualenv-1.8.4/virtualenv.py $HOME/venv | ||
$HOME/venv/bin/pip install virtualenvwrapper | $HOME/venv/bin/pip install virtualenvwrapper | ||
chmod 755 $HOME/venv/virtualenv-1. | chmod 755 $HOME/venv/virtualenv-1.8.4/scripts/virtualenv | ||
</pre> | </pre> | ||
| Line 18: | Line 18: | ||
VIRTUALENVWRAPPER_PYTHON=$HOME/venv/bin/python | VIRTUALENVWRAPPER_PYTHON=$HOME/venv/bin/python | ||
source $HOME/venv/bin/virtualenvwrapper.sh | source $HOME/venv/bin/virtualenvwrapper.sh | ||
export PATH=$HOME/venv/virtualenv-1. | export PATH=$HOME/venv/virtualenv-1.8.4/scripts:$PATH | ||
</pre> | </pre> | ||
Revision as of 21:39, 8 January 2013
If you are looking to setup a buildbot master in a virtualenv, this page will have more accurate information Master_Setup
Initial Setup
mkdir $HOME/venv cd $HOME/venv wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.8.4.tar.gz tar zxf virtualenv-1.8.4.tar.gz python virtualenv-1.8.4/virtualenv.py $HOME/venv $HOME/venv/bin/pip install virtualenvwrapper chmod 755 $HOME/venv/virtualenv-1.8.4/scripts/virtualenv
then add these lines to your ~/.bashrc or ~/.zshrc
export WORKON_HOME=$HOME/.virtualenvs VIRTUALENVWRAPPER_PYTHON=$HOME/venv/bin/python source $HOME/venv/bin/virtualenvwrapper.sh export PATH=$HOME/venv/virtualenv-1.8.4/scripts:$PATH
Using virtual environments
To create a new virtual environment, use 'mkvirtualenv', e.g.
mkvirtualenv buildapi
This will create and activate a new virtual environment where you can install new packages, e.g.
pip install mysql-python
To switch between virtual environments, use the 'workon' command, e.g.
workon buildbot-0.7
All of the heavy lifting here is done by virutalenvwrapper