- Installation¶
- Supported Methods¶
- ensurepip ¶
- get-pip.py ¶
- Alternative Methods¶
- Compatibility¶
- Installing pip/setuptools/wheel with Linux Package Managers¶
- Fedora¶
- CentOS/RHEL¶
- Installation¶
- Supported Methods¶
- ensurepip ¶
- get-pip.py ¶
- Alternative Methods¶
- Upgrading pip ¶
- Compatibility¶
- Установка PIP для Python и базовые команды
- Что такое PIP для Python?
- Устанавливается ли PIP вместе с Python?
- Правильно ли Python установлен?
- Как установить PIP на Windows.
- Как установить PIP на Mac
- Как установить PIP на Linux
- Как установить PIP на Raspberry Pi
- Как обновить PIP для Python
- Как устанавливать библиотеки Python с помощью PIP
- How To Install PIP to Manage Python Packages in Linux
- Install PIP in Linux Systems
- Install PIP On Debian/Ubuntu
- Install PIP On CentOS and RHEL
- Install PIP on Fedora
- Install PIP on Arch Linux
- Install PIP on openSUSE
- How to Use PIP in Linux Systems
- If You Appreciate What We Do Here On TecMint, You Should Consider:
Installation¶
Usually, pip is automatically installed if you are:
using Python downloaded from python.org
using Python that has not been modified by a redistributor to remove ensurepip
Supported Methods¶
If your Python environment does not have pip installed, there are 2 mechanisms to install pip supported directly by pip’s maintainers:
ensurepip ¶
Python comes with an ensurepip module1, which can install pip in a Python environment.
More details about how ensurepip works and how it can be used, is available in the standard library documentation.
get-pip.py ¶
This is a Python script that uses some bootstrapping logic to install pip.
Open a terminal/command prompt, cd to the folder containing the get-pip.py file and run:
More details about this script can be found in pypa/get-pip’s README.
Alternative Methods¶
Depending on how you installed Python, there might be other mechanisms available to you for installing pip such as using Linux package managers .
These mechanisms are provided by redistributors of pip, who may have modified pip to change its behaviour. This has been a frequent source of user confusion, since it causes a mismatch between documented behaviour in this documentation and how pip works after those modifications.
If you face issues when using Python and pip installed using these mechanisms, it is recommended to request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).
Compatibility¶
The current version of pip works on:
Windows, Linux and MacOS.
CPython 3.6, 3.7, 3.8, 3.9 and latest PyPy3.
pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above. Previous patch versions are supported on a best effort approach.
pip’s maintainers do not provide support for users on older versions of Python, and these users should request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).
The ensurepip module was added to the Python standard library in Python 3.4.
Источник
Installing pip/setuptools/wheel with Linux Package Managers¶
This section covers how to install pip , setuptools , and wheel using Linux package managers.
If you’re using a Python that was downloaded from python.org, then this section does not apply. See the Requirements for Installing Packages section instead.
Note that it’s common for the versions of pip , setuptools , and wheel supported by a specific Linux Distribution to be outdated by the time it’s released to the public, and updates generally only occur for security reasons, not for feature updates. For certain Distributions, there are additional repositories that can be enabled to provide newer versions. The repositories we know about are explained below.
Also note that it’s somewhat common for Distributions to apply patches for the sake of security and normalization to their own standards. In some cases, this can lead to bugs or unexpected behaviors that vary from the original unpatched versions. When this is known, we will make note of it below.
Fedora¶
To learn more about Python in Fedora, please visit the official Fedora docs, Python Classroom or Fedora Loves Python.
CentOS/RHEL¶
CentOS and RHEL don’t offer pip or wheel in their core repositories, although setuptools is installed by default.
To install pip and wheel for the system Python, there are two options:
Enable the EPEL repository using these instructions. On EPEL 7, you can install pip and wheel like so:
Since EPEL only offers extra, non-conflicting packages, EPEL does not offer setuptools, since it’s in the core repository.
Enable the PyPA Copr Repo using these instructions 1. You can install pip and wheel like so:
To additionally upgrade setuptools, run:
To install pip, wheel, and setuptools, in a parallel, non-system environment (using yum) then there are two options:
Use the “Software Collections” feature to enable a parallel collection that includes pip, setuptools, and wheel.
Be aware that collections may not contain the most recent versions.
Enable the IUS repository and install one of the parallel-installable Pythons, along with pip, setuptools, and wheel, which are kept fairly up to date.
For example, for Python 3.4 on CentOS7/RHEL7:
Источник
Installation¶
Usually, pip is automatically installed if you are:
using Python downloaded from python.org
using Python that has not been modified by a redistributor to remove ensurepip
Supported Methods¶
If your Python environment does not have pip installed, there are 2 mechanisms to install pip supported directly by pip’s maintainers:
ensurepip ¶
Python comes with an ensurepip module1, which can install pip in a Python environment.
More details about how ensurepip works and how it can be used, is available in the standard library documentation.
get-pip.py ¶
This is a Python script that uses some bootstrapping logic to install pip.
Open a terminal/command prompt, cd to the folder containing the get-pip.py file and run:
More details about this script can be found in pypa/get-pip’s README.
Alternative Methods¶
Depending on how you installed Python, there might be other mechanisms available to you for installing pip such as using Linux package managers .
These mechanisms are provided by redistributors of pip, who may have modified pip to change its behaviour. This has been a frequent source of user confusion, since it causes a mismatch between documented behaviour in this documentation and how pip works after those modifications.
If you face issues when using Python and pip installed using these mechanisms, it is recommended to request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).
Upgrading pip ¶
Upgrading your pip by running:
Compatibility¶
The current version of pip works on:
Windows, Linux and MacOS.
CPython 3.6, 3.7, 3.8, 3.9, 3.10 and latest PyPy3.
pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above. Previous patch versions are supported on a best effort approach.
pip’s maintainers do not provide support for users on older versions of Python, and these users should request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).
The ensurepip module was added to the Python standard library in Python 3.4.
Источник
Установка PIP для Python и базовые команды
Как любой серьёзный язык программирования, Python поддерживает сторонние библиотеки и фреймворки. Их устанавливают, чтобы не изобретать колесо в каждом новом проекте. Необходимы пакеты можно найти в центральном репозитории Python — PyPI (Python Package Index — каталог пакетов Python).
Однако скачивание, установка и работа с этими пакетами вручную утомительны и занимают много времени. Именно поэтому многие разработчики полагаются на специальный инструмент PIP для Python, который всё делает гораздо быстрее и проще.
Что такое PIP для Python?
Сама аббревиатура — рекурсивный акроним, который на русском звучит как “PIP установщик пакетов” или “Предпочитаемый установщик программ”. Это утилита командной строки, которая позволяет устанавливать, переустанавливать и деинсталлировать PyPI пакеты простой командой pip .
Если вы когда-нибудь работали с командной строкой Windows и с терминалом на Linux или Mac и чувствуете себя уверенно, можете пропустить инструкции по установке.
Устанавливается ли PIP вместе с Python?
Если вы пользуетесь Python 2.7.9 (и выше) или Python 3.4 (и выше), PIP устанавливается вместе с Python по умолчанию. Если же у вас более старая версия Python, то сначала ознакомьтесь с инструкцией по установке.
Правильно ли Python установлен?
Вы должны быть уверены, что Python должным образом установлен на вашей системе. На Windows откройте командную строку с помощью комбинации Win+X . На Mac запустите терминал с помощью Command+пробел , а на Linux – комбинацией Ctrl+Alt+T или как-то иначе именно для вашего дистрибутива.
Затем введите команду:
На Linux пользователям Python 3.x следует ввести:
Если вы получили номер версии (например, Python 2.7.5 ), значит Python готов к использованию.
Если вы получили сообщение Python is not defined (Python не установлен), значит, для начала вам следует установить Python. Это уже не по теме статьи. Подробные инструкции по установке Python читайте в теме: Скачать и установить Python.
Как установить PIP на Windows.
Следующие инструкции подойдут для Windows 7, Windows 8.1 и Windows 10.
- Скачайте установочный скрипт get-pip.py. Если у вас Python 3.2, версия get-pip.py должны быть такой же. В любом случае щелкайте правой кнопкой мыши на ссылке и нажмите “Сохранить как…” и сохраните скрипт в любую безопасную папку, например в “Загрузки”.
- Откройте командную строку и перейдите к каталогу с файлом get-pip.py.
- Запустите следующую команду: python get-pip.py
Как установить PIP на Mac
Современные версии Mac идут с установленными Python и PIP. Так или иначе версия Python устаревает, а это не лучший вариант для серьёзного разработчика. Так что рекомендуется установить актуальные версии Python и PIP.
Если вы хотите использовать родную систему Python, но у вас нет доступного PIP, его можно установить следующей командой через терминал:
Если вы предпочитаете более свежие версии Python, используйте Homebrew. Следующие инструкции предполагают, что Homebrew уже установлен и готов к работе.
Установка Python с помощью Homebrew производится посредством одной команды:
Будет установлена последняя версия Python, в которую может входить PIP. Если после успешной установки пакет недоступен, необходимо выполнить перелинковку Python следующей командой:
Как установить PIP на Linux
Если у вас дистрибутив Linux с уже установленным на нем Python, то скорее всего возможно установить PIP, используя системный пакетный менеджер. Это более удачный способ, потому что системные версии Python не слишком хорошо работают со скриптом get-pip.py, используемым в Windows и Mac.
Advanced Package Tool (Python 2.x)
Advanced Package Tool (Python 3.x)
pacman Package Manager (Python 2.x)
pacman Package Manager (Python 3.x)
Yum Package Manager (Python 2.x)
Yum Package Manager (Python 3.x)
Dandified Yum (Python 2.x)
Dandified Yum (Python 3.x)
Zypper Package Manager (Python 2.x)
Zypper Package Manager (Python 3.x)
Как установить PIP на Raspberry Pi
Как пользователь Raspberry, возможно, вы запускали Rapsbian до того, как появилась официальная и поддерживаемая версия системы. Можно установить другую систему, например, Ubuntu, но в этом случае вам придётся воспользоваться инструкциями по Linux.
Начиная с Rapsbian Jessie, PIP установлен по умолчанию. Это одна из серьёзных причин, чтобы обновиться до Rapsbian Jessie вместо использования Rapsbian Wheezy или Rapsbian Jessie Lite. Так или иначе, на старую версию, все равно можно установить PIP.
На Rapsbian для Python 2.x следует пользоваться командой pip, а для Python 3.x — командой pip3 при использовании команд для PIP.
Как обновить PIP для Python
Пока PIP не слишком часто обновляется самостоятельно, очень важно постоянно иметь свежую версию. Это может иметь значение при исправлении багов, совместимости и дыр в защите.
К счастью, обновление PIP проходит просто и быстро.
Для Mac, Linux, или Raspberry Pi:
На текущих версиях Linux и Rapsbian Pi следует использовать команду pip3.
Как устанавливать библиотеки Python с помощью PIP
Если PIP работоспособен, можно начинать устанавливать пакеты из PyPI:
Установка определённой версии вместо новейшей версии пакета:
Поиск конкретного пакета:
Просмотр деталей об установленном пакете:
Список всех установленных пакетов:
Список всех устаревших пакетов:
Обновление устаревших пакетов:
Следует отметить, что старая версия пакета автоматически удаляется при обновлении до новой версии.
Источник
How To Install PIP to Manage Python Packages in Linux
Pip (recursive acronym for “Pip Installs Packages” or “Pip Installs Python“) is a cross-platform package manager for installing and managing Python packages (which can be found in the Python Package Index (PyPI)) that comes with Python 2 >=2.7.9 or Python 3 >=3.4 binaries that are downloaded from python.org.
In this article, we will explain how to install PIP on mainstream Linux distributions.
Note: We will run all commands as the root user, if you are managing your system as a normal user, then use the sudo command to get root privileges or you can as well configure your system to run sudo command without entering a password, it’s possible. Try it out!
Install PIP in Linux Systems
To install pip in Linux, run the appropriate command for your distribution as follows:
Install PIP On Debian/Ubuntu
Install PIP On CentOS and RHEL
Unluckily, pip is not packaged in official software repositories of CentOS/RHEL. So you need to enable the EPEL repository and then install it like this.
Install PIP on Fedora
Install PIP on Arch Linux
Install PIP on openSUSE
How to Use PIP in Linux Systems
To install, uninstall or search new packages, use these commands.
To see a list of all commands type:
Sample Output
You may also like to read these following related articles about Python.
In this article, we showed you how to install PIP on mainstream Linux distributions. To ask any questions relating to this topic, please take advantage of the feedback form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник