Skip to content

Python3 create and active a python virtual environment

Intro to Python3 environments

While using Python, you might want to use a separate environment to keep pip packages separate from other environments
or separate from your main operation system.

Python virtual environments is on of the options for that.
Of course you could use containers but here I just want a quick and simple virtual environment to run python code.

Official page and documentation

Python 3 creating a virtual environment

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

-m use for python module venv virtual environment module /path/to/new/virtual/environment folder/directory for the virtual environment

Python 3 activating a virtual environment

source <venv>/bin/activate

Happy learning!

Antonio Feijao UK