Report this

What is the reason for this report?

Python virtual environments

Posted on March 1, 2023

I successfully installed a virtual environment in Ubuntu 22.10 (VirtualBox) by following this excellent tutorial: www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-ubuntu-22-04. Thank you, Alex. I have two follow up questions:

  1. A clarification, please. The tutorial directs us to cd into the directory created for our virtual environments (here “environments”) and to both create and activate the environment created from this “environments” directory. In other words, we should do our work from within the main “environments” directory, and not from the my_env directory that is created by the python3 -m venv my_env command. Is this correct? I am asking, because I am planning to create a second virtual environment, and to use a different/older version of Ptyhon. Somehow I feel I should be working from within the respective directory created by the venv command, especially since I will have more than one environment.
  2. I am running the Python version 3.10.7, which is the latest update available from the Ubuntu repo. But would need to install a version of Python 3.9 to use in my second virtual environment. Could someone please direct me to a tutorial on how to do that?

Thanks. I have always found the DigitalOcean tutorials comprehensive and well-written.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.