Once everything is configured we should be ready to start creating new virtual environments.
Creating a new virtual environment
For creating a new environment we need to add the path to the python executable we want to use. So first we need to download the python version we want to play with. For this example I’am using Python3.4.1:
brew install python3 --with-brewed-openssl
We can use “brew info” to find the path where the package as been installed:
brew info python3
In this case the path is “/usr/local/Cellar/python3/3.4.1” and the python executable is in the bin folder, so the final path is “/usr/local/Cellar/python3/3.4.1/bin/python“.
The sintaxis for creating a new virtualenv is the following:
mkvirtualenv -p [The python executable path] [virtualenv name]
So now we can create a virtual environment using the python interpreter we’ve just downloaded:
mkvirtualenv -p /usr/local/Cellar/python3/3.4.1/bin/python python3.4
If you need more info about virtualenv commands, please visit Virtualenv commands.