Python/virtualenv

From Omnia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

venv

Create virtual environment:

python3 -m venv [project_name]

This will create a folder called "[project_name]"

To use the folder:

source [project_name]/bin/activate

Then pip install whatever you want

To deactivate the virtual env: (from within the virutalenv)

deactivate

Ref: [1]

virtualenv

Pretty much identical but called using "virtualenv" instead of module

pip install virtualenv

Create env:

virutalenv [project]

Create env with particular python:

virtualenv -p $(which python2) [project]

Activate:

source [project]/bin/activate

Deactivate:

deactivate

Ref: [2]