Debian upgrade python version

Update Python 3 on Debian

This article explains how to install the latest version of Python3 from source code on Debian 10.

Prerequisites

1. Check the Installed Version

Check the installed Python3 version.

You will see something like this.

If your version is older than your application requires, proceed with this guide.

2. Update Python3

# apt-get install wget build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev liblzma-dev -y 
# wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 
# cd Python-3.9.6 && ./configure --enable-optimizations 
# update-alternatives --install /usr/bin/python python /usr/local/bin/python3.9 1 

2. Update Pip

# /usr/local/bin/python3.9 -m pip install --upgrade pip 
# update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.9 1 
Python 3.9.6 pip 21.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9) 

Conclusion

Keeping your Python up-to-date is an important part of the development process. It provides bug fixes compared to older versions, and more importantly, it introduces new features and optimizations.

Want to contribute?

You could earn up to $600 by adding new articles.

Читайте также:  Как заблокировать диспетчер задач python

Источник

Как обновить Python в Linux?

Как обновить Python в Linux?

Руководство по обновлению Python в операционных системах семейства Linux.

Введение

Представь себе ситуацию, ты придумал какой-нибудь проект, решил реализовать его на Python, открываешь терминал и обнаруживаешь старую версию, например Python 3.4.

Правильно, обновить Python через пакетный менеджер.

Далее я расскажу как это сделать.

Не забываем самое главное.

Все команды необходимо выполнять под пользователем root или же через sudo.

Обновление Python

Рассмотрим несколько примеров обновления Python в самых популярных дистрибутивах

Обновление Python в Debian Linux (Ubuntu, Raspbian, Mint и другие)

В моем случае я буду использовать raspberrypi 4 с дистрибутивом raspbian (основан на Debian buster). Открываем терминал (или подключаемся по ssh) и вводим команду apt update

Обновление python в дистрибутивах основанных на Debian (Ubuntu и др)

Видим примерно такую же ситуацию, локальный репозиторий обновил информацию о доступным пакетах из сетевого репозитория и стали доступны обновления других пакетов. Но мы сейчас не об этом. Нас интересует только python.

Как обновить Python в Linux?

В моем дистрибутиве используется последняя доступная версия 3.7.3-1

Обновление Python в Red Hat Linux (CentOS и Fedora Linux)

В принципе обновление пакетов в linux имеет схожий алгоритм. Сперва вы получаете список доступных пакетов из удаленного репозитория и сравнивание с тем, что установлено у вас локально. После обновление локального репозитория нужно инициализировать установку python. Разнообразных дистрибутивов linux у меня под рукой нет, да и используя я в серверных вариантах только debian-based. Но информация о работе с другими пакетными менеджерами доступна онлайн:)

Обновление python выполняется одной командой

Заключение

В этом руководстве мы узнали как обновить Python в Linux.

Источник

How To Upgrade Python?

How To Upgrade Python?

Python is a popular programming language that has a very active community and upgraded regularly. Currently, Python has two main versions Python2 and Python3. There are a lot of minor release versions where the latest Python3 version is 3.9.1. In order to use this version, the Python installation should be upgraded from older versions. In this tutorial, we will examine how to upgrade Python into a specific or latest version.

Before upgrade displaying current Python installation version can be helpfull. Current python installation can be printed with the –version option in the command line interface. The following command can be executed in Windows PowerShell, MS-DOS, Linux Terminal, Bash, MacOSX Terminal.

The currently installed Python version is listed like below.

In some cases specifying the major python version to get version information is better way.

Upgrade Python For Windows

Different Python versions for Windows are provided via the python.org web site. The latest version for the current installation can be downloaded and upgraded. The following page provides both Python2 and Python3 installers for the latest and previous versions. Simply select the version you want to upgrade and download the installer.

When the download is completed double click to the installer. We will see the following screen which informs that the current Python installer upgrade to the Python 3.9.1 (64-bit). We will simply click to the “Upgrade Now” button. This installation replace our existing installation without changing settings. Alternatively you can click to customize the installation and change some settings.

During the upgrade we will see the following Setup Progress screen.

Upgrade Python For Linux

Upgrading Python in Linux is very easy with the package managers like apt-get, apt, yum, dnf etc. Actually generic update and upgrade commands for these package managers upgrades the PYthon into the most recent versions.

Upgrade Python for Debian, Mint, Kali, Ubuntu with apt-get:

sudo apt-get update && sudo apt-get dist-upgrade

Upgrade Python for Debian, Mint, Kali, Ubuntu with apt:

sudo apt update && sudo apt dist-upgrade

Upgrade Python for CentOS, RHEL, Fedora with yum:

Upgrade Python for CentOS, RHEL, Fedora with dnf:

Alternatively we can only upgrade Python into the recent version without upgrading other packages like below.

Upgrade Python for Debian, Mint, Kali, Ubuntu with apt-get:

sudo apt-get update && sudo apt-get dist-upgrade python

Upgrade Python for Debian, Mint, Kali, Ubuntu with apt:

sudo apt update && sudo apt dist-upgrade python

Upgrade Python for CentOS, RHEL, Fedora with yum:

Upgrade Python for CentOS, RHEL, Fedora with dnf:

Источник

How to Update/Upgrade Python in Linux [Ubuntu/RedHat]

Update/Upgrade Python in Linux

This article will show you how to update Python to the latest version on your Linux Operating system.

Python is updated yearly with new features and big upgrades – these are called major updates. In addition to this, monthly updates are released which fix small issues and improve security – these are called minor updates.

Major updates change how Python works a bit and may break compatibility with some code as features are added or removed, whereas minor updates are solely there to fix problems without altering any functionality.

Updating From Python 2 to Python 3

Python 3 is still actively developed, receiving both minor and major updates. Python 2 is obsolete – it’s no longer developed, and you shouldn’t be using it for any new projects or to learn.

If you’re upgrading from Python 2 to Python 3, you will need to check your code is compatible – the syntax differs slightly between the two.

Python 2 and Python 3 are treated as separate software packages by most Linux package managers. To upgrade to version 3, simply install it.

The rest of this article will focus on the actively developed Python 3 only.

Install the Latest Version of Python on Ubuntu/Debian

On Ubuntu/Debian based distributions (including Mint, PopOS, etc) – run the following command:

This will install the default Python 3 version currently available on Ubuntu.

To install a specific version of Python 3, specify the full version:

sudo apt install python3.9

Install the Latest Version of Python on Fedora/RHEL

To install Python on RedHat based operating systems, run the following:

sudo dnf install python39

Note that the major version of Python 3 is always specified when installing using the dnf package manager – in this case, Python 3.9

Checking What Version of Python is Currently Installed

To check which version of Python you have installed, run:

Using a Package Manager to Upgrade Python Version

If Python 3 is already installed on your system, it will be updated along with the rest of your system when a software update is run.

sudo apt-get update sudo apt-get upgrade

Updating Minor/Major Versions

On Ubuntu/Debian based systems, Python will update to the default version available via the package manager. This is usually a bit behind the official release but is considered stable. This may include major releases if you have installed via the python3 package rather than a specific version.

On Fedora, only minor updates will be applied – you’ll need to install the next major release manually when it is available.

Источник

Оцените статью