Skip to content

How to Set up Python Virtual Environments

DebRez edited this page Jun 22, 2016 · 12 revisions

The standard python virtual environment settings are in mtt/pyenv.txt as described in the mtt/console/README.md file. To see which virtual environments have been setup and are available to use type:

$ workon

To switch between environments type:

$ workon yourEnv

To exit a virtual environment type:

$ deactivate

Before making a new virtual environment be sure to deactivate the environment you are currently in as shown above.
To create your new environment enter:

$ mkvirtualenv -r pyenv.txt --python=/usr/bin/(python of your choice) yourEnv

It is not necessary to include --python=, default is the system default.

In order to make the conversion between code already written in Python 2.6+ to Python 2/3, or to make Python 3+ code work with Python 2/3 use the environment text file pyenv2_3.txt to setup your working environment.

Clone this wiki locally