Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 56 lines (37 sloc) 1.42 KB

Virtual Environment Tutorial

Step 1: First install VirtualEnv and VirtualEnvWrapper (if not installed):

MAC / Linux:

python -m pip install --upgrade virtualenv
python -m pip install --upgrade virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

If you add source /usr/local/bin/virtualenvwrapper.sh to your local bash file (~/.bash_profile on a Mac, or ~/.bashrc on Linux), virtualenvwrapper commands will be available whenever you open a new command prompt.

WINDOWS:

python -m pip install --upgrade virtualenv
python -m pip install --upgrade virtualenvwrapper-win

Step 2: Now use VirtualEnv or VirtualEnvWrapper to create a virtual environment:

MAC / Linux / WINDOWS:

mkvirtualenv seleniumbase

If you ever need to leave your virtual environment, use the following command:

deactivate

You can always jump back into your virtual environment later:

workon seleniumbase

To list all existing virtual environments:

lsvirtualenv

To delete a virtual environment:

rmvirtualenv VIRTUAL_ENV_NAME


python-guide.org/en/latest/dev/virtualenvs has more information about Python virtual environments.