Date Tags python

A quick starter on Python Virtual Environment

Create:

mkdir workingdir
cd workingdir
virtualenv venv

On Unix/Mac OS X use:

source venv/bin/activate

On Windows use:

venv\Scripts\activate.bat

Finish:

deactivate

To move the environment somewhere else:

  1. In existing (active) environment; grab a list of dependencies with pip freeze > requirements.txt
  2. In new (active) environment; install from the dependency list with pip install -r requirements.txt

To set a specific Python version. On Mac:

  1. First find the path to the version we want with which python3
  2. Activate the environment and run mkvirtualenv --python=<path to python> <venv> For example mkvirtualenv --python=/usr/local/bin/python3 myenv