Installing virtualenv
In order to install virtualenv, we are going to call in pip for help. We will install it as a globally available package for the Python interpreter to run.
The simplest method is using pip to search, download and install. This might not provide you the latest stable version.
Downloading virtualenv using pip:
# Example: [sudo] pip install virtualenv
pip install virtualenv
Creating / Initiating a virtual environment (virtualenv)
Creating an environment using the same interpreter used to run it:
# Example: virtualenv [folder (env.) name]
# Let's create an environment called *my_app*
virtualenv my_app
Creating an environment with a custom Python-2.7.9 interpreter:
# Example: virtualenv --python=[loc/to/python/] [env. name]
virtualenv --python=/usr/local/bin/python2.7 my_app
Activating a virtual environment
# Example: source [env. name]/bin/activate
# Let's activate the Python environment we just created
source my_app/bin/activate
Comments (0)