Notes for virtualenv
03 May 2016Notes for virtualenv
Virtualenv is a tool for creating isolated ‘virtual’ python environment. It makes sure different versions of packages and dependencies can exist in a same machine.
To install: pip install virtualenv
Basic command:
virtualenv ENV: ENV is a directory to place the new virtual enviornment.ENV/lib/andENV/include/are created and used to store library files for a new virtualenv python.ENV/binis created for executables files. Runing a script with#! /path/to/ENV/bin/pythonwould run that script under this virtualenv’s python.
- Enable a virtual environment:
source ENV/bin/activate - Disable a virtual environment:
deactivate - Delte a virtual environment:
deactivateandrm -r ENV -
Make envrionment relocatable:
virtualenv --relocatable ENV - Check what is installed:
pip install yolkyolk -l
Here is a great tutorial for virtualenv.
To use virtualenv install Python3, we can do the following (reference):
pip install --upgrade virtualenvvirtualenv -p python3 envname