|
|
(11 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| Virtual environments are isolated Python environments. They allow freedom to install specific versions of dependencies without affecting the global site-packages. They also make it easy to throw away a 'broken' environment and start again. If you need further information regarding virtual environments, please see the [http://www.doughellmann.com/docs/virtualenvwrapper/index.html virtualenvwrapper documentation]. | | Virtual environments are isolated Python environments. They allow freedom to install specific versions of dependencies without affecting the global site-packages. They also make it easy to throw away a broken environment and start again. We recommend using '''virtualenvwrapper''' for managing your virtual environments. See the documentation for a guide to [http://virtualenvwrapper.readthedocs.org/en/latest/install.html installation] and the [http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html command reference]. There's also a useful introduction to virtualenv and virtualenvwrapper in [http://www.silverwareconsulting.com/index.cfm/2012/7/24/Getting-Started-with-virtualenv-and-virtualenvwrapper-in-Python this blog post]. |
| | |
| == Install virtualenvwrapper ==
| |
| <ol>
| |
| <li>Install virtualenvwrapper:</li>
| |
| sudo pip install virtualenvwrapper
| |
| <li>Add the following to your ~/.bash_profile:</li>
| |
| export WORKON_HOME=$HOME/.virtualenvs
| |
| source /usr/local/bin/virtualenvwrapper.sh
| |
| </ol>
| |
| | |
| == Create a virtual environment for WebQA ==
| |
| mkvirtualenv webqa
| |
| | |
| == Switch to the WebQA virtual environment ==
| |
| workon webqa
| |
| | |
| == Installation on Windows ==
| |
| <i>Exception: use 32-bit version of the setuptools even if your operating system is 64-bit otherwise it fails to find the Python installation.</i>
| |
| <ol>
| |
| <li>Install the 32-bit version of [http://pypi.python.org/pypi/setuptools#files SetupTools] using the provided <b>.exe installer</b>.</li>
| |
| <li>Download the last pip version from [http://pypi.python.org/pypi/pip#downloads here] and uncompress it.</li>
| |
| <li>In your <b><i>cmd prompt</i></b>, go to the uncompressed pip directory and run <b><i>python setup.py install</i></b></li>
| |
| <li>Add <b><i>C:\Python26\Scripts</i></b> to your System Variables path.</li>
| |
| <li>Now you can use the command pip install package on Win.</li>
| |
| </ol>
| |
| === Virtualenvwrapper Installation and Usage ===
| |
| <ol>
| |
| <li>From the <b><i>cmd prompt</i></b> install pip:</li>
| |
| pip install virtualenvwrapper-win
| |
| <li>Set your environment variable:</li>
| |
| WORKON_HOME = C:\Python27\Scripts
| |
| <li>You can now create virualenvs by running <b><i>mkvirtualenv <name of the environment</i><</b></li>
| |
| </ol>
| |