|
|
(3 intermediate revisions by 3 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>
| |
| === PIP Installation ===
| |
| <ol>
| |
| <li>Install the 32-bit version of SetupTools using the provided .exe installer:</li>
| |
| http://pypi.python.org/pypi/setuptools#files
| |
| <li>Add the Scripts directory to your System Variables path:</li>
| |
| C:\Python26\Scripts
| |
| <li>Download the last pip version and uncompress it:</li>
| |
| http://pypi.python.org/pypi/pip#downloads
| |
| <li>In your cmd prompt, go to the uncompressed pip directory and run:</li>
| |
| python setup.py install
| |
| <li>Now you can install packages using pip on Win.</li>:
| |
| pip install <<i>package name</i>>
| |
| </ol>
| |
| | |
| === Virtualenvwrapper Installation and Usage ===
| |
| <ol>
| |
| <li>From the cmd prompt install pip:</li>
| |
| pip install virtualenvwrapper-win
| |
| <li>Set your environment variable:</li>
| |
| WORKON_HOME = C:\Python27\Scripts:
| |
| <li>You can now create virtualenvs:</li>
| |
| mkvirtualenv <<i>name of the environment</i>>
| |
| </ol>
| |