11

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

3
  • 1
    which doesn't always work. Try type instead. If that doesn't help, what repo did you install it from? You can confirm by running apt policy python3.9. I assume you used deadsnakes (http://ppa.launchpad.net/deadsnakes/ppa/ubuntu). Commented Sep 29, 2022 at 19:26
  • You're running Ubuntu 22.04 LTS (Jammy), right? Commented Sep 29, 2022 at 19:27
  • Just to note you probably don't want to use apt update alternatives to switch between Python versions. This will change your Python interpreter version system-wide which is likely to break things, if Ubuntu (the OS) has anything which depends on a particular version of Python being the default. Commented Apr 11, 2024 at 8:30

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.