This blog post is a small cheat sheet on setting up a virtual environment for Python venv.
Note: The virtual environment installation.
python3 -m pip install --user virtualenv
Step 1: Create a virtual environment
python3.11 -m venv my-env-3.11
When you look into your current folder, you will notice that the execution of this command created a new folder called my-env-3.11.
my-env-3.11
|-bin
|-include
|-lib
pyvenv.cfg
Step 2: Activate the environment
source ./my-env-3.11/bin/activate
Step 3: Install your project-related requirements
python3 -m pip install -r requirements.txt
Step 3: Deactivate the virtual environment
deactivate
I hope this was useful to you, and let’s see what’s next?
Greetings,
Thomas
#python, #venv, #cheatsheet