I want to install Python 3.10 on Ubuntu 18.04 (I'm currently on Python 3.8) from the deadsnakes repository with the following set of commands I found on the internet:
sudo add-apt-repository ppa:deadsnakes/ppasudo apt updatesudo apt install python3.10
But I got the error sudo: add-apt-repository: command not found
.
More net research led me to this set of commands at "ModuleNotFoundError: No module named 'apt_pkg'" appears in various commands - Ask Ubuntu:
sudo apt remove python3-aptsudo apt autoremovesudo apt autocleansudo apt install python3-apt
Other web sources said the same thing, so I did that, but I still get the error message when I run sudo add-apt-repository ppa:deadsnakes/ppa
.
Then I found How to Fix 'add-apt-repository command not found' on Ubuntu & Debian - phoenixNAP, which advised this set of commands:
sudo apt updatesudo apt install software-properties-commonsudo apt update
so I did that, but when I run sudo add-apt-repository ppa:deadsnakes/ppa
I now get this error message:
~$ sudo add-apt-repository ppa:deadsnakes/ppaTraceback (most recent call last): File "/usr/bin/add-apt-repository", line 12, in <module> from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 28, in <module> import apt_pkgModuleNotFoundError: No module named 'apt_pkg'
I have found some web links that show a wide variety of solutions with earlier versions of Python. I'm currently on Python 3.8.
Before I do anything more I want to ask what is the best way to solve the ModuleNotFoundError: No module named 'apt_pkg'
error message when trying to install the deadsnakes repository to install Python 3.10, given the number of possible solutions I have seen.
Thanks very much.