Как установить python на debian
Перейти к содержимому

Как установить python на debian

  • автор:

How To Install Python 3.11 on Debian 11/10

The Python team has announced the new release of Python 3.11. At the same time, Python 3.12 development has been started. So as of today, Python 3.11 is the latest version available for installation. This version is loaded with various new features and security upgrades. The Python developer will feel better with this version in terms of error display and debugging etc.

This tutorial will help you to install Python 3.11 on Debian 11 & Debian 10 Linux systems. The tutorial will compile and install Python 3.11 source code on your system.

Prerequisites

Log in to your Debian system with a sudo privileged account. Then open a terminal (CTRL+ALT+T) and execute the below commands to update packages.

Then install the required packages for the compilation of Python source code.

Install Python 3.11 on Debian

The default Debian package repositories contain the older versions of Python packages. So if the older version fulfills your requirements, you should install that from default repositories. To explore the latest version features, compile and install Python from the source code on the Debian system.

Use the following step-by-step instructions to install Python 3.11 on your Debian system:

  1. Download Python: Download the Python 3.11 source code from its FTP website.
  2. Extract Archive: Once the downloading is finished, extract the archive with the tar command on your system.
  3. Compiling Python Source: Change to the extracted directory with cd command, then prepare the Python source code for the compilation with ./configure on your system.
  4. Installing Python 3.11: Finally, as the source code is ready to compile, you can use te make command to compile and install Python from the source code on the Debian system. Here altinstall prevents the compiler to override default Python versions.

The compilation may take some time depending on system specifications. Wait for the Python installation to complete on your system.

Check Python Version

At this stage, you will have the Python 3.11 installed on your Debian 11 and Debian 10 systems. You need to type python3.11 to use this version. For example, to check the Python version, execute:

The compilations process also installed the PIP for your Python. To check the version of pip for Python, execute:

That’s it, You have successfully installed Python 3.11 on Debian 11 and Debian 10 systems.

Conclusion

In conclusion, Python is a high-level, general-purpose programming language used for web applications as well as system programming. In this tutorial, you have learned to install Python 3.11 on Debian Linux systems using source code. You can try Python examples via command line.

How to Install Python on Debian Linux

Python is an on-demand programming language that continues to grow in popularity under the Linux operating system ecosystem. Aside from its strong attributes like versatility and ease of use, mastering Python can transform the life of a Linux user for good reasons.

For instance, consider the following benefits associated with mastering Python programming language under a Linux environment:

  • Numerous job opportunities – Python is applicable in many career fields such as data analytics, Machine Learning, data science, and Artificial Intelligence.
  • Well-Paying Career – Python skills in the software development market average handsome annual salary rates.
  • Growing demand for Python Developers – Whether you are into game development, web development, or general software development, there is always something for everyone in the Python development market.

This article will walk us through the installation of Python on a Debian Linux distribution.

Install Python on Debian Using APT

Now that you have the need inspiration to start using Python, it is time to install it on your Debian system. We will use the apt package manager for the installation:

The above command should install the latest stable Python3 version on your Debian system.

Install Python in Debian

Install Python in Debian

If you want to compile Python from the source to test out certain features that might not available on your distro’s package. You can easily compile the latest release of Python from the source as shown.

Install Python on Debian from the Source

First, update the Debian system and then install system dependencies.

Next, download the latest Python source release using the following wget command and install it as shown.

Install Python Modules in Debian Using PIP

With Python successfully installed on your Debian system, you can now install various Python modules via PIP (Python package manager).

Once PIP is installed, you can install any Python module using the following command.

Install Python Module in Debian

Install Python Module in Debian

For more usage of the Python pip command, read our article – Python PIP Cheat Sheet for Linux.

You can now explore what Python has to offer on Debian Linux.

Как установить Python 3.10 на Debian 11 / Debian 10

hosting.energy недорогой хостинг сайтов

Добро пожаловать в это руководство по установке Python 3.10 в системе Debian 11 / Debian 10 Linux. Python 3.10 — это последняя версия Python, но она нестабильна по сравнению с предыдущей версией Python 3.9, окончательный кандидат еще не готов. Являющийся одним из широко используемых объектно-ориентированных языков программирования с открытым исходным кодом, набирает популярность благодаря своему простому и легкому в освоении синтаксису. Python используется в следующих областях:

  • Обработка больших данных и выполнение сложных математических задач.
  • Подключение к системам баз данных, чтение и изменение файлов.
  • Быстрое прототипирование или разработка программного обеспечения, готового к производству.
  • Используется вместе с программным обеспечением для создания рабочих процессов.
  • Создание веб-приложений.

Последняя версия Python 3.10 включает следующие интересные функции;

  • Сопоставление структурного образца
  • Заключенные в скобки менеджеры контекста
  • Улучшенные сообщения об ошибках
  • Улучшения интерпретатора с точными числами для отладки
  • Дополнительные обновления о функциях ввода, которые позволяют использовать типы объединения как X | Y, переменные спецификации параметров и т. Д.
  • Обновления безопасности и т. Д.

Узнав о новых функциях Python 3.10, давайте установим его в нашей системе Debian 11 | 10.

Приступаем к установке

Для этого руководства вам понадобятся:

  1. Debian 11 | 10 Установленная операционная система
  2. Пользователь с привилегиями sudo.

Обновите вашу систему.

Скачать Python 3.10 для Debian 11 / Debian 10

В этом руководстве мы установим Python 3.10 на Debian 11 | 10, собрав его из исходного кода. Одним из преимуществ этого метода является то, что нам гарантируется последняя доступная версия Python.

Сначала нам нужно установить необходимые зависимости, чтобы иметь возможность собирать Python 3.10 из исходного кода.

Затем загрузите Python 3.10 с официальной страницы выпуска Python . На этой странице загрузите тарбол Python 3.10 Gzippeed . Или же получите ссылку для загрузки и потяните ее с помощью Wget, как показано.

Загрузив архив, распакуйте его, как показано ниже.

Перейдите в извлеченный каталог и запустите команду configure, чтобы проверить, доступны ли необходимые зависимости. В команде флаг –enable-optimizations используется для оптимизации двоичного файла и запуска нескольких тестов.

Когда проверка будет завершена, соберите Python 3.10 из исходного кода, как показано ниже. Не забудьте ускорить процесс, используя флаг -j. Это определяет количество ядер в вашей системе. nproc команда показывает ядра вашей системы.

Когда make будет завершена, продолжите и установите Python 3.10 на Debian 11 | 10, как показано ниже.

altinstall Флаг используется для сохранения по умолчанию Python двоичный путь в /usr/bin/phyton .

Проверьте вашу установку.

Установите модули Python | Расширения в Debian 11 | 10

Расширения и модули важны для Python, поскольку они добавляют функциональность приложению Python. Эти расширения и модули можно установить в Debian 11 | 10 с помощью диспетчера пакетов Python (PIP), который устанавливается с помощью команды:

С помощью PIP вы можете легко установить нужный модуль, используя синтаксис.

Продемонстрируем это с помощью модуля beautifulsoup4 .

Создайте виртуальную среду Python

Виртуальная среда Python — это место, где установлены интерпретатор Python, библиотеки и сценарии. Чтобы убедиться, что Python правильно установлен в нашей системе Debian 11 | 10, давайте создадим простой проект Python.

Создайте каталог проекта.

Находясь в каталоге, мы создадим виртуальную среду для sample_app.

Следующим шагом будет активация окружения.

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

Заключение

Это знаменует конец этого руководства. Мы успешно рассмотрели, как установить Python 3.10 на Debian 11 | 10, установить модули и создать виртуальную среду. Надеюсь, это имело для вас значение.

Install python on Linux

Python runs on many operating systems such as MS-Windows, Mac OS, Mac OS X, Linux, FreeBSD, OpenBSD, Solaris, AIX, and many varieties of free UNIX like systems. The latest version of CentOS, Fedora, RHEL and Ubuntu come with Python 2.7 out of the box.

To see which version of Python you have install, open a command terminal and run:

That is the version of python you have got and you can start building Python applications .

Use package manager

The easiest way to install the Python is to use package manger such as apt-get, yum, and so on.

Debian / Ubuntu Linux user

Use the following command to search for available versions of Python2.x under Debian and Ubuntu Linux:

Type the following command to install python version 2.x:

Type the following command to install python version 3.x:

Red Hat/ RHEL / CentOS Linux user

Type the following command:

From the Internet

Your can also download the version you want from the Internet.

Type the following command to download it:

Type the folowing command to extract the file and go into the directory:

Read the README file to figure out how to install, or do the following with no guarantees:

For other versions and the most up to date download links: http://www.python.org/getit/

Others

Setuptools & Pip

The two most crucial third-party Python packages are setuptools and pip.

Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default.

To see if pip is installed, open a command prompt and run:

To install pip, follow the official pip installation guide — this will automatically install the latest version of setuptools.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *