Saturday, October 8, 2022

[SOLVED] Multiple Python versions in the same Ubuntu machine

Issue

I am on an Ubuntu machine, where Python 3.10 is automatically installed. To do a given task in a shared codebase I need to use Python 3.9 for some issues with new versions.

I would like to have both of the Python installed on my machine and be able to use both and switching if I need to.

So, I am trying to install old Python 3.9 with the command sudo apt-get install python3.9 and it succeeded in installation, but I can't find it anywhere even with which python3.9 and similar.

Even the python interpreter option in VSCode does not show it.

I think I am missing something. Can please someone help me? Thank you


Solution

Python should be installed under the /usr/bin/ folder. If it's not there, you might have not actually installed the package.

Check out this guide for installing specific versions (Scroll down to the "Use Deadsnakes PPA to Install Python 3 on Ubuntu" section.)

This will allow you to install specific version of python like python3.9



Answered By - Chris
Answer Checked By - Katrina (WPSolving Volunteer)