avatardatatec.studio

Summary

This web page provides instructions on how to upgrade Python from version 3.10 to 3.11 on Ubuntu 22.04, as well as how to install pip for Python 3.11.

Abstract

The web page titled "Upgrade Python 3.10 to 3.11 on Ubuntu 22.04" explains the process of upgrading Python from version 3.10 to 3.11 on Ubuntu 22.04. The page begins by explaining how to check the current Python version and then proceeds to outline the steps required to add an additional repository for downloading Python 3.11. The page then provides instructions on how to install Python 3.11 and configure it as the default Python version. The page also includes a note on a potential error that may occur during the process and provides a solution for it. The second part of the page provides instructions on how to install pip for Python 3.11. The page concludes with a thank you note and an invitation to follow the author on Medium and try out their recommended AI service.

Opinions

  • The author assumes that the reader has some familiarity with the command line and basic Linux commands.
  • The author provides clear and detailed instructions for upgrading Python and installing pip.
  • The author acknowledges potential errors that may occur during the process and provides a solution for one such error.
  • The author encourages reader feedback and suggestions for improving the article.
  • The author promotes their own AI service at the end of the article.
  • The author does not provide any information on the benefits or use cases of upgrading to Python 3.11.
  • The author does not provide any information on the potential risks or downsides of upgrading to Python 3.11.

Upgrade Python 3.10 to 3.11 on Ubuntu 22.04

Python 3.10 was provided by Ubuntu 22.04 as default.

This post shows how to upgrade python from 3.10 to 3.11.

1. Upgrade Python from 3.10 to 3.11

2. Install pip

1. Upgrade Python from 3.10 to 3.11

# Check python version use python and python3
# The first comman will Not show version info.
# The second one show 3.10 as version as it is provided by ubuntu as default
python --version
python3 --version

# Add additional repository to download python 3.11
sudo add-apt-repository ppa:deadsnakes/ppa

# This might take more than few minutes
sudo apt update
sudo apt upgrade

# Install python 3.11
sudo apt-get install python3.11

# python3 shows 3.10 and python3.11 shows 3.11 as version
python3 --version
python3.11 --version

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2

sudo update-alternatives --config python3
#choose 2 for python 3.11

# 3.11 will be shown as version
python3 --version

sudo apt install python-is-python3

# 3.11 will be shown as version
python --version

Note:

You might get error “ModuleNotFoundError: No module named ‘apt_pkg’” when “sudo apt update” was executed later. Such error can also occured when installing azure-cli. One solution could be:

cd /usr/lib/python3/dist-packages/
cp apt_pkg.cpython-310-x86_64-linux-gnu.so apt_pkg.so

2. Install pip

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

python -m pip --version

# You can also do this for ~/.zshrc
nano ~/.bashrc
# add this line to the end of file, save and exit the file
alias pip='python -m pip'

pip --version

pip install --upgrade pip

Thank you for reading. I hope you enjoyed today’s content.

If you have any suggestion to improve this article, please let me know.

You are welcome to my network:

Follow me on Medium

Python
Upgrade
Ubuntu
Update
Alias
Recommended from ReadMedium