User Tools

Site Tools


venv_python

Virtual Environment for Python

The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. Each virtual environment has its own Python binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Python packages in its site directories.

https://docs.python.org/3/library/venv.html

Initialize the Environment

python3 -m venv /path/to/new/virtual/environment

Activate the Environment

cd /path/to/new/virtual/environment
 
source ./bin/activate

Deactivate the Environment

deactivate

Bash Prompt

Bash prompt, normal:

username@hostname:~/current/path$

Bash prompt, with virtual environment activated:

(current_dir) username@hostname:~/current/path$
venv_python.txt · Last modified: 2023/07/14 13:22 by jimc