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/bin
is created for executables files. Runing a script with#! /path/to/ENV/bin/python
would 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:
deactivate
andrm -r ENV
-
Make envrionment relocatable:
virtualenv --relocatable ENV
- Check what is installed:
pip install yolk
yolk -l
Here is a great tutorial for virtualenv
.
To use virtualenv install Python3, we can do the following (reference):
pip install --upgrade virtualenv
virtualenv -p python3 envname