Update Python Version to 3.10 and Remove Python 3.8

Update Python Version to 3.10 and Remove Python 3.8

I am using Ubuntu 20.04 which comes with Python 3.8. I want to install Python 3.10 AND remove Python 3.8 because I lack disk space. I know how to install Python 3.10, but I am afraid that I will break my system once I remove Python 3.8.

FYI, I plan to use these commands to do it (ofc I run everything as root user):

add-apt-repository ppa:deadsnakes/ppa
apt install -y python3.10
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
update-alternatives --config python3 #then select python3.10
#found the above from 
#my own code below
apt autoremove python3.8

Is that proper way of replacing Python 3.8 with Python 3.10? Thx :)

P.S. I installed a bunch of Python 3.8 "plugins" (sorry that is what I like to call) like python3.8-venv, I also want to remove them if unusable (I am not sure about that so I did not include this in my code above).

7

1 Answer

DON'T!

Removing the Python version that comes with your system is very likely to break it. Instead set up dedicated python environments for different versions.

Alternatively, update to Ubuntu 22.04 that comes with Python 3.10.4. As of today, it is only a week before final release.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.