get-pip.py
get-pip.py
is a bootstrapping script that enables users to install pip,
setuptools, and wheel in Python environments that don’t already have them. You
should not directly reference the files located in this repository and instead
use the versions located at https://bootstrap.pypa.io/.
Usage
$ curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ python get-pip.py
Upon execution, get-pip.py
will install pip
, setuptools
and wheel
in
the current Python environment.
It is possible to provide additional arguments to the underlying script. These
are passed through to the underlying pip install
command, and can thus be
used to constraint the versions of the packages, or to pass other pip options
such as --no-index
.
$ python get-pip.py "pip < 21.0" "setuptools < 50.0" "wheel < 1.0" $ python get-pip.py --no-index --find-links=/local/copies
get-pip.py options
This script also has it’s own options, which control which packages it will
install.
--no-setuptools
: do not attempt to installsetuptools
.--no-wheel
: do not attempt to installwheel
.
Development
You need to have a nox
available on the CLI.
How it works
get-pip.py
bundles a copy of pip with a tiny amount of glue code. This glue
code comes from the templates/
directory.
Updating after a pip release
If you just made a pip release, run nox -s update-for-release -- <version>
.
This session will handle all the script updates (by running generate
), commit
the changes and tag the commit.
IMPORTANT: Check that the correct files got modified before pushing. The session
will pause to let you do this.
Generating the scripts
Run nox -s generate
.
Discussion
If you run into bugs, you can file them in our issue tracker.
You can also join #pypa
or #pypa-dev
on Freenode to ask questions or
get involved.
Code of Conduct
Everyone interacting in the get-pip project’s codebases, issue trackers, chat
rooms, and mailing lists is expected to follow the PSF Code of Conduct.
Project description
pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.
Please take a look at our documentation for how to install and use pip:
-
Installation
-
Usage
We release updates regularly, with a new version every 3 months. Find more details in our documentation:
-
Release notes
-
Release process
In pip 20.3, we’ve made a big improvement to the heart of pip; learn more. We want your input, so sign up for our user experience research studies to help us do it right.
Note: pip 21.0, in January 2021, removed Python 2 support, per pip’s Python 2 support policy. Please migrate to Python 3.
If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:
-
Issue tracking
-
Discourse channel
-
User IRC
If you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:
-
GitHub page
-
Development documentation
-
Development IRC
Code of Conduct
Everyone interacting in the pip project’s codebases, issue trackers, chat
rooms, and mailing lists is expected to follow the PSF Code of Conduct.
Download files
Download the file for your platform. If you’re not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Introduction
PIP is a package management system used to install and manage software packages written in Python. It stands for “preferred installer program” or “Pip Installs Packages.”
PIP for Python is a utility to manage PyPI package installations from the command line.
If you are using an older version of Python on Windows, you may need to install PIP. You can easily install PIP on Windows by downloading the installation package, opening the command line, and launching the installer.
This tutorial will show how to install PIP on Windows, check its version, upgrade, and configure.
Note: The latest versions of Python come with PIP pre-installed, but older versions require manual installation. The following guide is for version 3.4 and above. If you are using an older version of Python, you can upgrade Python via the Python website.
Prerequisites
- Computer running Windows or Windows server
- Access to the Command Prompt window
Before you start: Check if PIP is Already Installed
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
Before you install PIP on Windows, check if PIP is already installed.
1. Launch the command prompt window:
- Press Windows Key + X.
- Click Run.
- Type in cmd.exe and hit enter.
Alternatively, type cmd in the Windows search bar and click the “Command Prompt” icon.
2. Type in the following command at the command prompt:
pip help
If PIP responds, then PIP is installed. Otherwise, there will be an error saying the program could not be found.
Installing PIP On Windows
Follow the steps outlined below to install PIP on Windows.
Step 1: Download PIP get-pip.py
Before installing PIP, download the get-pip.py file.
1. Launch a command prompt if it isn’t already open. To do so, open the Windows search bar, type cmd and click on the icon.
2. Then, run the following command to download the get-pip.py file:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Step 2: Installing PIP on Windows
To install PIP type in the following:
python get-pip.py
If the file isn’t found, double-check the path to the folder where you saved the file. You can view the contents of your current directory using the following command:
dir
The dir
command returns a full listing of the contents of a directory.
Step 3: Verify Installation
Once you’ve installed PIP, you can test whether the installation has been successful by typing the following:
pip help
If PIP has been installed, the program runs, and you should see the location of the software package and a list of commands you can use with pip
.
If you receive an error, repeat the installation process.
Step 4: Add Pip to Windows Environment Variables
To run PIP from any location, you need to add it to Windows environment variables to avoid getting the «not on PATH» error. To do so, follow the steps outlined below:
- Open the System and Security window by searching for it in the Control Plane.
- Navigate to System settings.
- Then, select Advanced system settings.
- Open the Environment Variables and double-click on the Path variable in the System Variables.
- Next, select New and add the directory where you installed PIP.
- Click OK to save the changes.
Step 5: Configuration
In Windows, the PIP configuration file is %HOME%pippip.ini.
There is also a legacy per-user configuration file. The file is located at %APPDATA%pippip.ini
.
You can set a custom path location for this config file using the environment variable PIP_CONFIG_FILE
.
Upgrading PIP for Python on Windows
New versions of PIP are released occasionally. These versions may improve the functionality or be obligatory for security purposes.
To check the current version of PIP, run:
pip --version
To upgrade PIP on Windows, enter the following in the command prompt:
python -m pip install --upgrade pip
This command uninstalls the old version of PIP and then installs the most current version of PIP.
Downgrade PIP Version
Downgrading may be necessary if a new version of PIP starts performing undesirably. To downgrade PIP to a prior version, specifying the version you want.
To downgrade PIP, use the syntax:
python -m pip install pip==version_number
For example, to downgrade to version 18.1, you would run:
python -m pip install pip==18.1
You should now see the version of PIP that you specified.
Conclusion
Congratulations, you have installed PIP for Python on Windows. Check out our other guides to learn how to install PIP on other operating systems:
- Install PIP on CentOS
- Install PIP on Ubuntu
- Install PIP on Debian
- Install PIP on Mac
Now that you have PIP up and running, you are ready to manage your Python packages.
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices. Check out our guide and learn how to install NumPy using PIP.
Prerequisite: Python Language Introduction
Before we start with how to install pip for Python on Windows, let’s first go through the basic introduction to Python. Python is a widely-used general-purpose, high-level programming language. Python is a programming language that lets you work quickly and integrate systems more efficiently.
PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “online repository” termed as Python Package Index (PyPI). pip uses PyPI as the default source for packages and their dependencies. So whenever you type:
pip install package_name
pip will look for that package on PyPI and if found, it will download and install the package on your local system.
Check if Python is installed
Run the following command to test if python is installed or not. If not click here.
python --version
If it is installed, You will see something like this:
Python 3.10.0
Download and Install pip
The PIP can be downloaded and installed using the command line by going through the following steps:
Method 1: Using cURL in Python
Curl is a UNIX command that is used to send the PUT, GET, and POST requests to a URL. This tool is utilized for downloading files, testing REST APIs, etc.
Step 1: Open the cmd terminal
Step 2: In python, a curl is a tool for transferring data requests to and from a server. Use the following command to request:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
Method 2: Manually install PIP on Windows
Pip must be manually installed on Windows. You might need to use the correct version of the file from pypa.org if you’re using an earlier version of Python or pip. Get the file and save it to a folder on your PC.
Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed.
Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists.
Step 3: get-pip.py is a bootstrapping script that enables users to install pip in Python environments. Run the command given below:
python get-pip.py
Step 4: Now wait through the installation process. Voila! pip is now installed on your system.
Verification of the installation process
One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute the following command:
pip -V or pip --version
Adding PIP To Windows Environment Variables
If you are facing any path error then you can follow the following steps to add the pip to your PATH. You can follow the following steps to set the Path:
- Go to System and Security > System in the Control Panel once it has been opened.
- On the left side, click the Advanced system settings link.
- Then select Environment Variables.
- Double-click the PATH variable under System Variables.
- Click New, and add the directory where pip is installed, e.g. C:Python33Scripts, and select OK.
Upgrading Pip On Windows
pip can be upgraded using the following command.
python -m pip install -U pip
Downgrading Pip On Windows
It may happen sometimes that your pip current pip version is not supporting your current version of python or machine for that you can downgrade your pip version with the following command.
Note: You can mention the version you want to install
python -m pip install pip==17.0
Python 3.4+ and 2.7.9+
Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community’s wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js, Haskell, Perl, Go—almost every other contemporary language with a majority open-source community. Thank you, Python.
If you do find that pip is not available, simply run ensurepip
.
-
On Windows:
py -3 -m ensurepip
-
Otherwise:
python3 -m ensurepip
Of course, that doesn’t mean Python packaging is problem solved. The experience remains frustrating. I discuss this in the Stack Overflow question Does Python have a package/module management system?.
Python 3 ≤ 3.3 and 2 ≤ 2.7.8
Flying in the face of its ‘batteries included’ motto, Python ships without a package manager. To make matters worse, Pip was—until recently—ironically difficult to install.
Official instructions
Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:
Download get-pip.py
, being careful to save it as a .py
file rather than .txt
. Then, run it from the command prompt:
python get-pip.py
You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).
This installs the pip package, which (in Windows) contains …Scriptspip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of ‘Alternative Instructions’ for adding it to your PATH,
Alternative instructions
The official documentation tells users to install Pip and each of its dependencies from source. That’s tedious for the experienced and prohibitively difficult for newbies.
For our sake, Christoph Gohlke prepares Windows installers (.msi
) for popular Python packages. He builds installers for all Python versions, both 32 and 64 bit. You need to:
- Install setuptools
- Install pip
For me, this installed Pip at C:Python27Scriptspip.exe
. Find pip.exe
on your computer, then add its folder (for example, C:Python27Scripts
) to your path (Start / Edit environment variables). Now you should be able to run pip
from the command line. Try installing a package:
pip install httpie
There you go (hopefully)! Solutions for common problems are given below:
Proxy problems
If you work in an office, you might be behind an HTTP proxy. If so, set the environment variables http_proxy
and https_proxy
. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password@proxy_url:port
If you’re really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can’t cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/
Unable to find vcvarsall.bat
Python modules can be partly written in C or C++. Pip tries to compile from source. If you don’t have a C/C++ compiler installed and configured, you’ll see this cryptic error message.
Error: Unable to find vcvarsall.bat
You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.
Often though it’s easier to check Christoph’s site for your package.
Installing with get-pip.py¶
To install pip, securely download get-pip.py. [1]:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Inspect get-pip.py
for any malevolence. Then run the following:
Warning
Be cautious if you are using a Python install that is managed by your operating
system or another package manager. get-pip.py
does not coordinate with
those tools, and may leave your system in an inconsistent state.
get-pip.py
also installs setuptools [2] and wheel
if they are not already. setuptools is required to install
source distributions. Both are
required in order to build a Wheel Cache (which improves installation
speed), although neither are required to install pre-built wheels.
Note
The get-pip.py script is supported on the same python version as pip.
For the now unsupported Python 2.6, alternate script is available
here.
get-pip.py options¶
-
--no-setuptools
¶
-
If set, do not attempt to install setuptools
-
--no-wheel
¶
-
If set, do not attempt to install wheel
get-pip.py
allows pip install options and the general options. Below are
some examples:
Install from local copies of pip and setuptools:
python get-pip.py --no-index --find-links=/local/copies
Install to the user site [3]:
Install behind a proxy:
python get-pip.py --proxy="http://[user:passwd@]proxy.server:port"
Upgrading pip¶
On Linux or macOS:
On Windows [4]:
python -m pip install -U pip
Python and OS Compatibility¶
pip works with CPython versions 2.7, 3.3, 3.4, 3.5, 3.6 and also pypy.
This means pip works on the latest patch version of each of these minor
versions. Previous patch versions are supported on a best effort approach.
pip works on Unix/Linux, macOS, and Windows.
[1] | “Secure” in this context means using a modern browser or a tool like curl that verifies SSL certificates when downloading from https URLs. |
[2] | Beginning with pip v1.5.1, get-pip.py stopped requiring setuptools tobe installed first. |
[3] | The pip developers are considering making --user the default for allinstalls, including get-pip.py installs of pip, but at this time,--user installs for pip itself, should not be considered to be fullytested or endorsed. For discussion, see Issue 1668. |
[4] | https://github.com/pypa/pip/issues/1299 |
В этой статье в очередной раз коснёмся темы установки PIP на Python. Вы узнаете, что делать, если PIP не установлена, как поставить эту систему, а также как выполняется инсталляция на Windows, Mac, Linux и Raspberry Pi. Дополнительно будут рассмотрены вопросы обновления и работы.
Python, как и любой другой серьёзный язык программирования, поддерживает дополнительные (сторонние) фреймворки и библиотеки. Эти библиотеки устанавливаются разработчиками с простой целью: облегчить себе жизнь и каждый раз не изобретать колесо в новом проекте. Нужные пакеты находятся в PyPI, который можно назвать центральным репозиторием Python и каталогом Python-пакетов (Python Package Index).
Но скачивать и устанавливать эти пакеты вручную — занятие утомительное, а порой и времязатратное. Лучше всего использовать для этих целей специальный инструмент для Python, делающий процесс проще и быстрее. Как вы уже догадались, речь идёт про PIP. И если PIP не установлен, обязательно восполните этот пробел.
Что же такое PIP?
Сама аббревиатура PIP («пип») представляет собой рекурсивный акроним. По сути, это система управления пакетами. Она применяется в целях установки и управления программными пакетами, которые написаны на Python. Ещё систему называют предпочитаемым установщиком программ. А непосредственно pip — это команда, запускающая соответствующую утилиту для установки, переустановки и деинсталляции пакетов, которые находятся в вышеупомянутом PyPI.
Часто возникает вопрос, а не устанавливается ли PIP одновременно с Пайтоном? Да, если речь идёт о следующих версиях:
— Python версии 2.7.9 и выше;
— Python версии 3.4 и выше.
В вышеупомянутых случаях «пип» устанавливается по дефолту и вместе с Python. Но если же речь идёт о более старых версиях, PIP не установлена. Однако установить PIP совсем несложно. Но прежде чем это сделать, рекомендуется проверить свою версию Python, а также то, правильно ли он у вас инсталлирован.
Проверка версии Python
Для выполнения проверки Python следует открыть командную строку. Она вам понадобится и при последующих действиях. Следует привыкать работать с командной строкой, т. к. многие операции быстрее, удобнее и нагляднее выполнять именно через неё. Если же вы начинающий системный администратор, знание терминала — это пункт под номером 0 в списке необходимых скиллов.
Запускаем командную строку следующим образом:
1. На Windows. Используем комбинацию клавиш «Win+X».
2. На Mac. Нажимаем «Command+пробел».
3. На Линукс. Работает комбинация «Ctrl+Alt+T».
Когда терминал открыт, вводим следующую команду:
Если у вас Linux и Python 3.x, вводим несколько другую команду:
В итоге вы должны получить актуальную версию Питона, которая установлена на вашу операционную систему. Если же что-то не так, вы получите сообщение, что Пайтон не установлен (Python is not defined).
Устанавливаем PIP на Windows
Инструкции, представленные ниже, подойдут для ОС Windows 7/8.1/10. Общий порядок действий, если PIP не установлен, следующий:
1. Скачиваем официальный установочный скрипт с именем get-pip.py. Для начала нажимаем правую кнопку мыши, потом «Сохранить как…». В итоге скрипт сохранится по указанному вами пути (пусть это будет папка «Загрузки»).
2. Открываем терминал (командную строку), после чего переходим к каталогу, где вы поместили файл get-pip.py.
3. Выполняем команду python get-pip.py.
Всё, установка запустится (installs), и инсталляция модуля будет завершена в сжатые сроки. Способ простой и действенный.
Устанавливаем на Mac
В современных версиях Mac как Python, так и PIP уже установлены. Однако со временем они устаревают, что нехорошо, поэтому лучше следить за тем, чтобы на вашем компьютере были актуальные версии. Но если вы хотите работать с той версией Python, которая есть, и желаете инсталлировать последнюю версию системы, сделать это можно простой командой, запустив в терминале следующее:
Для установки более новых версий языка программирования Python вам пригодится Homebrew. С его помощью Пайтон устанавливается тоже очень просто (предполагается, что утилита командной строки Homebrew уже установлена):
По итогу получите последнюю версию Python, в которую, кстати говоря, система «пип» уже может входить. Но если же пакет будет недоступен, выполните перелинковку:
brew unlink python && brew link pythonУстанавливаем на Linux
Для дистрибутивов Linux желательно использовать системный менеджер пакетов и штатные репозитории. Команды могут различаться с учётом конкретного дистрибутива. Для примера возьмём популярный дистрибутив Ubuntu. Если у вас Python 3, в терминале выполняем:
sudo apt install python3-pipА потом проверяем, что получилось:
Если же речь идёт о Пайтон 2, команды установки и проверки версии будут чуть другими:
sudo apt install python-pipКак установить PIP на Raspberry Pi
Если вы являетесь пользователем Raspberry, эта часть статьи для вас. Если же вы даже не в курсе, что такое Raspberry, можете смело пропустить данный абзац.
Уже начиная с Rapsbian Jessie, система устанавливается по дефолту, то есть вопросов о том, что PIP не установлена, не возникает. Это ещё и причина обновить ОС до Rapsbian Jessie а не использовать Rapsbian Wheezy/Jessie Lite. Однако никто не мешает установить систему и на старую версию.
Для Python 2 это выглядит следующим образом:
sudo apt-get install python-pipДля третьей версии изменения в команде крайне незначительны:
sudo apt-get install python3-pipВ процессе работы нужно будет применять pip и pip3 соответственно.
Обновляем PIP для Python
Для многих разработчиков очень важно иметь последнюю версию установщика программ. Это имеет особое значение, если мы говорим о сохранении приемлемого уровня безопасности, исправлении ошибок (багов) и т. д.
Обновить PIP не составляет труда:
1. Для Windows. Используем команду python -m pip install -U pip.
2. Для Mac, Линукс либо Raspberry Pi — pip install -U pip.Устанавливаем Python-библиотеки посредством PIP
Когда установка (installing) завершена, «пип» установился и готов к работе. В результате мы можем приступать к установке пакетов с помощью PIP из PyPI. Делается это с помощью простейшего синтаксиса, содержащего минимум кода:
По умолчанию с помощью вышеприведённого синтаксиса будет установлена новейшая версия нужного пакета. Но иногда требуется конкретная версия, то есть более старая:
pip install имя_пакаета==1.0.0Также вы можете найти конкретный пакет:
pip search "ваш_запрос_поиска"Или посмотреть детали уже установленного (installed):
Ещё пользователю доступен список всех пакетов, которые установлены:
А также список пакетов PIP, которые устарели:
Но это не беда, ведь можно выполнить обновление:
pip install имя_пакета --upgradeОднако учтите, что при обновлении старая версия будет удалена.
Ещё может возникнуть необходимость в полной переустановке пакета:pip install имя_пакета --upgrade --force-reinstallСовсем несложно и удалить пакет:
Это основы, которые должен знать каждый. Если же вас интересует Python-разработка на более продвинутом уровне, добро пожаловать на курсы в OTUS!
Источники:
• https://pingvinus.ru/note/pip;
• https://pythonru.com/baza-znanij/ustanovka-pip-dlja-python-i-bazovye-komandy.
Как любой серьёзный язык программирования, Python поддерживает сторонние библиотеки и фреймворки. Их устанавливают, чтобы не изобретать колесо в каждом новом проекте. Необходимы пакеты можно найти в центральном репозитории Python — PyPI (Python Package Index — каталог пакетов 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
или как-то иначе именно для вашего дистрибутива.
Затем введите команду:
python --version
На Linux пользователям Python 3.x следует ввести:
python3 --version
Если вы получили номер версии (например, 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, его можно установить следующей командой через терминал:
sudo easy_install pip
Если вы предпочитаете более свежие версии Python, используйте Homebrew. Следующие инструкции предполагают, что Homebrew уже установлен и готов к работе.
Установка Python с помощью Homebrew производится посредством одной команды:
brew install python
Будет установлена последняя версия Python, в которую может входить PIP. Если после успешной установки пакет недоступен, необходимо выполнить перелинковку Python следующей командой:
brew unlink python && brew link python
Как установить PIP на Linux
Если у вас дистрибутив Linux с уже установленным на нем Python, то скорее всего возможно установить PIP, используя системный пакетный менеджер. Это более удачный способ, потому что системные версии Python не слишком хорошо работают со скриптом get-pip.py, используемым в Windows и Mac.
Advanced Package Tool (Python 2.x)
sudo apt-get install python-pip
Advanced Package Tool (Python 3.x)
sudo apt-get install python3-pip
pacman Package Manager (Python 2.x)
sudo pacman -S python2-pip
pacman Package Manager (Python 3.x)
sudo pacman -S python-pip
Yum Package Manager (Python 2.x)
sudo yum upgrade python-setuptools
sudo yum install python-pip python-wheel
Yum Package Manager (Python 3.x)
sudo yum install python3 python3-wheel
Dandified Yum (Python 2.x)
sudo dnf upgrade python-setuptools
sudo dnf install python-pip python-wheel
Dandified Yum (Python 3.x)
sudo dnf install python3 python3-wheel
Zypper Package Manager (Python 2.x)
sudo zypper install python-pip python-setuptools python-wheel
Zypper Package Manager (Python 3.x)
sudo zypper install python3-pip python3-setuptools python3-wheel
Как установить PIP на Raspberry Pi
Как пользователь Raspberry, возможно, вы запускали Rapsbian до того, как появилась официальная и поддерживаемая версия системы. Можно установить другую систему, например, Ubuntu, но в этом случае вам придётся воспользоваться инструкциями по Linux.
Начиная с Rapsbian Jessie, PIP установлен по умолчанию. Это одна из серьёзных причин, чтобы обновиться до Rapsbian Jessie вместо использования Rapsbian Wheezy или Rapsbian Jessie Lite. Так или иначе, на старую версию, все равно можно установить PIP.
Для Python 2.x:
sudo apt-get install python-pip
Для Python 3.x:
sudo apt-get install python3-pip
На Rapsbian для Python 2.x следует пользоваться командой pip, а для Python 3.x — командой pip3 при использовании команд для PIP.
Как обновить PIP для Python
Пока PIP не слишком часто обновляется самостоятельно, очень важно постоянно иметь свежую версию. Это может иметь значение при исправлении багов, совместимости и дыр в защите.
К счастью, обновление PIP проходит просто и быстро.
Для Windows:
python -m pip install -U pip
Для Mac, Linux, или Raspberry Pi:
pip install -U pip
На текущих версиях Linux и Rapsbian Pi следует использовать команду pip3.
Как устанавливать библиотеки Python с помощью PIP
Если PIP работоспособен, можно начинать устанавливать пакеты из PyPI:
pip install package-name
Установка определённой версии вместо новейшей версии пакета:
pip install package-name==1.0.0
Поиск конкретного пакета:
pip search "query"
Просмотр деталей об установленном пакете:
pip show package-name
Список всех установленных пакетов:
pip list
Список всех устаревших пакетов:
pip list --outdated
Обновление устаревших пакетов:
pip install package-name --upgrade
Следует отметить, что старая версия пакета автоматически удаляется при обновлении до новой версии.
Полностью переустановить пакет:
pip install package-name --upgrade --force-reinstall
Полностью удалить пакет:
pip uninstall package-name