0

I have a Ubuntu 22.04 server and I need to install Python3.8 on it.

Here is what I did:

sudo apt update
sudo apt upgrade
sudo apt install python3.8 -y

The last command gave me this error:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3.8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.8' has no installation candidate

The server I am working on is a GCP instance, and it has Python3.10 installed before:

root@ansible-3:/usr/bin# ll python*
lrwxrwxrwx 1 root root       7 Jan  5 23:39 python -> python3*
lrwxrwxrwx 1 root root      10 Aug 18 10:39 python3 -> python3.10*
lrwxrwxrwx 1 root root      17 Aug 18 10:39 python3-config -> python3.10-config*
-rwxr-xr-x 1 root root 5921160 Nov 14 16:10 python3.10*
lrwxrwxrwx 1 root root      34 Nov 14 16:10 python3.10-config -> x86_64-linux-gnu-python3.10-config*

Any idea what is going on?

Thanks!

Philip Shangguan
  • 449
  • 5
  • 19
  • This means of all the repositories listed in your software sources, none of them have the package named `python3.8` [source](https://askubuntu.com/a/14693/1601848). Try to follow this [article](https://www.linuxcapable.com/install-python-3-8-on-ubuntu-linux/) – Jurakin Jan 06 '23 at 18:30
  • I would highly recommend you use virtual environments. With the use of [virtualenv](https://virtualenv.pypa.io/en/latest/index.html) you can create a virtual environment and install a [specific python version](https://stackoverflow.com/questions/65936980/how-to-set-up-specific-python-version-for-virtual-environment-for-python). The virtual environment is siloed and won't affect any global installation. – Kakedis Jan 06 '23 at 18:42
  • Thank you both for your replies and I will give it a try. – Philip Shangguan Jan 06 '23 at 21:52

0 Answers0