Python Virtual Environments
Last modified on July 24, 2026 • 1 min read • 177 wordsThere are many different ways to run Python in a virtual environment.

There are many different ways to run Python in a virtual environment. I have used mostly conda (together with anaconda), but I frequently end up doing work on machines that do not have it installed. Hence, I have been recently starting to use the “inbuilt” virtual environment. If you are working on a Python project in a directory, these are the steps to start using it:
- Create a new virtual environment in the current directory
python3 -m venv .
python3 -m venv .venv (if you want to keep it all tidy in one hidden subfolder)- “Activate” the virtual environment
source ./bin/activate
source .venv/bin/activate (for the alternative tidy version)- Install the packages that you need, here e.g. the logomaker package
pip3 install logomaker- Run your code!
python3 script_that_uses_logomaker-package.py- Exit the virtual environment
deactivateIf you need a different Python version (e.g. the older python3.8), you need to install it first. On Ubuntu, the most popular way to do this is via the deadsnakes PPAs:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8 python3.8-venv
python3.8 -m venv .venv