Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Use the code block macro in Python venv

...

The example below creates a new venv in the directory venv_aplus under the current working directory.

Code Block
languagebash
firstline1
titleCreation of Python virtual environment
linenumberstrue
aptdcon --install python3-venv

...


python3 -m venv venv_aplus

...


source venv_aplus/bin/activate

...


pip install --upgrade pip setuptools

...


pip install wheel

...


# You have created the virtual environment now, but usually you also want to install dependencies from some app to the venv.

...


# For example for A+, change directory to the a-plus (source code) directory that you cloned from git. It contains the required pip packages in the file requirements.txt.

...


pip install -r requirements.txt

The source command is used to activate the venv again at another time (in a new terminal window or after rebooting the machine): source venv_aplus/bin/activate

...