quick review of python venv setup

Home

1 Activating a venv

1.1 csh or tcsh


Reminder how to activate virtual environments for Zintis


cd /Users/zintis/bin

source venv-xpress/bin/activate.csh
source venv-prog-basics/bin/activate.csh
source venv-controllers-2.7/bin/activate.csh

Depending on which virtual environment you want to use.

1.2 bash

source venv-xpress/bin/activate
source venv-prog-basics/bin/activate
source venv-controllers-2.7/bin/activate

Depending on which virtual environment you want to use.

1.3 other shells available

(venv-xpress)% ls -la
(venv-xpress)% ls -l venv-xpress/bin/act*.*

activate
activate.csh
activate.fish
activate.ps1
activate.xsh
activate_this.py

(venv-xpress)% ls -la

2 Installing pre 3.6 with virtualenv


To create a new virtual environment, please read the pyenv.org document but in a nutshell you would:

  1. pip install –upgrade –user virtualenv
  2. virtualenv newname
  3. virtualenv newname –python=python3

    not both 2) and 3) but either 2) or 3) depending if you want to specify a specific python version, could also be –python=python2

  4. source newname/bin/activate.csh

3 Installing post 3.6 with venv

python3.9 -m venv newname

basically you use the built-in module venv to create the new virtual environment.

3.1 Home