Home > Blockchain >  Multiple Python versions in the same Ubuntu machine
Multiple Python versions in the same Ubuntu machine

Time:09-30

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

CodePudding user response:

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

CodePudding user response:

Packages on Ubuntu (usually executables) are installed in the /usr/bin directory. You could try to list all executables under /usr/bin with

ls /usr/bin/python*

This is the easiest way. You could see also what packages are installed

apt list --installed | grep python
  • Related