- Python установка на linux debian
- Introduction
- Python in Debian
- Maintainers
- Supported Python Versions
- Debian Python Policy for Python developers
- Deviations from upstream
- Encouraged practices
- Installing from Source
- See also
- How to Install Python on Debian Linux
- Install Python on Debian Using APT
- Install Python on Debian from the Source
- Install Python Modules in Debian Using PIP
- Как установить Python 3.9 на Debian 10
- Установка Python 3.9 на Debian 10
- Вывод
Python установка на linux debian
Introduction
Python, the high-level, interactive object oriented language, includes an extensive class library with lots of goodies for network programming, system administration, sounds and graphics. Debian provides the latest stable Python 3 release; it also provides the latest stable Python 2 release, but Python 2 is unsupported by the Python Foundation since 2020-01-01 and is being removed as of Debian 11 (Bullseye). It may also provide additional versions, as well as tons of third party packages. Python is an important part of the Debian ecosystem.
Python is very easy to learn. You can begin with the DebianWomen/PythonTutorial or the official online tutorial if you want to get started programming in Python. You might also be interested in the Python wiki, the Python FAQ, and the online documentation.
Software written in the Python programming language is executed by the Python interpreter. It is usually compiled into platform-independent bytecode files to increase performance. Python compiles and writes bytecode *.pyc files alongside the *.py sources. Extension modules can also be written in C, which are distributed as .so shared libraries.
Therefore, software written in pure Python can be distributed as source code or as compiled bytecode. The latter is similar to Java.
Python in Debian
As such, with hundreds of Python modules and multiple versions of Python supported, Debian is the largest «integrated Python distribution». Users of other operating systems (e.g. Windows and OS X) can also benefit from this integrative effort by means of virtualization (e.g. see NeuroDebian VM page for easy way to start)
Please also refer to the packaging style guide and Python Packaging wiki pages.
As of 2015-10-09 we now maintain all of our packages in Git. Here is team policy for using git for team packages.
NOTE: Debian 11 (bullseye) has removed the «python» package and the ‘/usr/bin/python’ symlink due to the deprecation of Python 2. No packaged scripts should depend on the existence of ‘/usr/bin/python’: if they do, that is a bug that should be reported to Debian. You can use the ‘python-is-python3’ or ‘python-is-python2’ packages to restore an appropriate ‘/usr/bin/python’ symlink for third-party or legacy scripts. See also Python/FAQ#Python_2_support.
Maintainers
- cpython-team maintains the Python compiler/interpreter package.
- Debian Python Team maintains some Python modules and applications.
Supported Python Versions
- Debian Bookworm currently contains 3.11, and will likely not ship Python 2, see also Python/FAQ#Python_2_support.
- Debian Bullseye contains 3.9, minimal support for 2.7
- Debian Buster contains Python 2.7, 3.7
- Debian Stretch contains Python 2.7, 3.5
- Debian Jessie contains Python 2.7, 3.4
- Debian Wheezy contains Python 2.7, 3.2
- Debian Squeeze contains Python 2.5, 2.6 (the default), 3.1.
- Debian Lenny contains Python 2.4 and 2.5 (the default).
- Debian Testing contains some 2.x and 3.x
- Debian Unstable contains some 2.x and 3.x, python2 is being removed https://wiki.debian.org/Python/2Removal
- Debian experimental may also contain some (experimental!) packages 2.x and 3.x
- Distribution(s) shipping python3.11
- Distribution(s) shipping python3.10
- Distribution(s) shipping python3.9
- Distribution(s) shipping python3.8 (none)
- Distribution(s) shipping python3.7
- Distribution(s) shipping python3.6 (none)
- Distribution(s) shipping python3.5
- Distribution(s) shipping python3.4
- Distribution(s) shipping python3.3
- Distribution(s) shipping python3.2
- Distribution(s) shipping python3.1
- Distribution(s) shipping python3.0 (none)
- Distribution(s) shipping python2.7
- Distribution(s) shipping python2.6
- Distribution(s) shipping python2.5 (none)
- Distribution(s) shipping python2.4 (none)
Debian Python Policy for Python developers
The Debian Python Policy describes conventions for packaging and distributing Python code in Debian.
Feel free to ask any questions on debian-python@lists.debian.org mailing list.
If you want to maintain a Python package, you have to know how the Debian Development works.
Deviations from upstream
- dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.
- The standard profile and pstats modules are not included, due to restrictive redistribution clauses in their license that don’t meet the DFSG. cProfile and hotshot are however included.
- In Debian 7 (Wheezy), the python-setuptools package installs the Distribute fork instead of the standard setuptools. In Debian 8 (Jessie), we reverted back to the merged setuptools project.
- Also in Debian 7 (Wheezy), the python-virtualenv also uses distribute by default, but can enable classic setuptools with an optional switch. As above, in Debian 8 (Jessie) this just use the merged setuptools.
- distutils setup scripts install files in /usr/local/ not sys.prefix (which is normally /usr/). This is because /usr/ is reserved for files installed from Debian packages. Note that /usr/local/lib/pythonX.Y/dist-packages is in sys.path so that modules not installed from Debian packages can still be accessed by the system Python. Tools like debhelper pass the --install-layout=deb option to the setup script while building a Debian package so that its installs files into /usr/ not /usr/local/.
- Python 2.7, 3.3, and 3.4 are multiarch aware.
Encouraged practices
- Style guide for packaging Python libraries (includes adding Python 3 support)
- Style guide for packaging Python applications (includes Python 3 support)
- There is a growing number of python-*-dbg packages for modules with extensions. They provide extensions built using python*-dbg libraries allowing to take advantage of GDB constantly improving support for debugging of Python modules and extensions. If you build extensions module, please provide corresponding -dbg package
- Converting your package to dh_python2
Installing from Source
If you want the latest version, or a development version of Python, you will likely need to install it from source. In order to do that, first make sure you have build dependencies. As root, run: «aptitude build-dep python3»
Pick your version and download the «Gzipped source tarball» of the version of your choice from Python download page. Once you have the archive, extract it using «tar -xvf Python-.tgz». Once that is done, go to that directory with «cd Python-» and use the following command to compile Python from source: «./configure && make && make test» (as regular user). To install it globally without damaging system Python installed with APT, use the altinstall target (as root): «make altinstall».
See also
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.
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.
$ sudo apt update $ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
Next, download the latest Python source release using the following wget command and install it as shown.
$ wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tar.xz $ tar -xf Python-3.10.7.tar.xz $ cd Python-3.10.7 $ ./configure $ make $ sudo make install $ python3 -V
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).
$ sudo apt install python3-pip [On Debian, Ubuntu and Mint] $ sudo yum install python3-pip [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a dev-lang/pip [On Gentoo Linux] $ sudo apk add py3-pip [On Alpine Linux] $ sudo pacman -S python-pip [On Arch Linux] $ sudo zypper install python3-pip [On OpenSUSE]
Once PIP is installed, you can install any Python module using the following command.
$ python3 -m pip install module_name
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.9 на Debian 10
Python — один из самых популярных языков программирования в мире. Это универсальный язык, используемый для создания всех видов приложений, от простых сценариев до сложных алгоритмов машинного обучения. Python с его простым и легким в освоении синтаксисом является популярным выбором как для начинающих, так и для опытных разработчиков.
Python 3.9 — это последняя крупная версия языка Python. Он включает в себя множество новых функций, таких как новые операторы dict, новые функции str, поддержка часового пояса IANA и многое другое .
В этой статье мы покажем вам, как установить Python 3.9 на Debian 10.
Debian 10 поставляется с Python 3.7, который можно установить или обновить с помощью инструмента apt
Установка Python 3.9 на Debian 10
Компиляция Python из исходного кода позволяет установить последнюю версию Python и настроить параметры сборки. Однако вы не сможете поддерживать установку Python с помощью диспетчера пакетов apt
Сборка Python 3.9 на Debian — относительно простой процесс, который займет всего несколько минут.
- Установите зависимости, необходимые для сборки Python:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
cd Python-3.9.1
./configure --enable-optimizations
Вот и все. Python 3.9 установлен и готов к использованию. Чтобы проверить это, введите:
В выводе должна отображаться версия Python:
Вывод
Мы показали вам, как установить Python 3.9 в вашу систему Debian 10. Теперь вы можете создать виртуальную среду и начать разработку своих проектов Python.
Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.