Вариант 1: Установка Python
PIP идет в наборе Python 3, соответственно, чтобы его установить в Windows 10, достаточно инсталлировать интерпретатор. Сделать это можно несколькими способами: посредством предустановленного приложения Microsoft Store или скачав с официального сайта установщик. Подробнее об этом рассказывается в другой нашей статье, при необходимости ознакомьтесь с ней, перейдя по ссылке ниже.
Подробнее: Как установить Python в Windows 10
Проверить наличие установленного PIP в системе можно путем вызова его справки. Для этого достаточно открыть «Командную строку» и ввести команду pip --version. В результате вы должны будете увидеть запись следующего вида — это будет означать, что все сделано верно.
Читайте также: Как открыть «Командную строку» в Windows 10
Вариант 2: Установка PIP
Если после установки Python 3 PIP отсутствует, значит, его необходимо установить в систему вручную. Делается это посредством официального репозитория. Кликните по кнопке ниже, чтобы перейти на страницу загрузки.
Скачать PIP с официального репозитория
Важно! Это руководство подразумевает, что у вас на компьютере уже установлена актуальная версия Python 3, в противном случае выполнить описываемые далее действия у вас не получится.
- Попав на страницу репозитория PIP, найдите в списке файл под названием «get-pip.py», именно он и является инсталлятором последней версии. Если вам необходима одна из предыдущих версий PIP, ищите ее в других папках, состоящих из цифр, которые соответствуют версиям. Кликните по названию, чтобы открыть этот файл.
- В браузере откроется текст скрипта «get-pip.py». Его необходимо сохранить себе на диск, чтобы в будущем запустить. Делается это стандартным способом — кликните в любом месте страницы правой кнопкой мыши и из списка функцией выберите «Сохранить как».
- В появившемся окне файлового менеджера перейдите в директорию, в которую хотите сохранить файл, после чего нажмите по кнопке «Сохранить».
Если на экране появится всплывающее уведомление, сообщающее о том, что у вас нет прав доступа на выполнение этого действия, кликните по кнопке «Да».
Вы будете перемещены в пользовательскую директорию, куда сохранить файл уже можно. В данном случае это папка «Документы». Кликните «Сохранить».
- Откройте окно файлового менеджера любым доступным способом, например, щелкнув по ярлыку «Этот компьютер» на рабочем столе. Затем перейдите в директорию, куда сохранили файл «get-pip.py». Зажав левую кнопку мыши, кликните по пустому пространству папки правой кнопкой. В появившейся расширенной версии контекстного меню выберите опцию «Открыть окно PowerShell здесь».
Читайте также: Как открыть «Проводник» в Windows 10
- В открывшемся окне с синим фоном впишите представленную ниже команду и нажмите по клавише Enter для ее выполнения.
python3.exe .\get-pip.pyПосле этого запустится скрипт по установке и обновлению PIP в Python 3. Следить за ходом этой процедуры вы можете непосредственно в окне консоли. Инсталляция будет завершена, когда в нижней части появится приглашение для ввода (
PS C: \Users\USER\Documents>). После все открытые в процессе выполнения описываемых в инструкции действий окна можно закрыть и продолжать работать за компьютером.
Обратите внимание! Систематически разработчики PIP выпускают новые версии своего программного продукта, оптимизируя его работу и добавляя новые библиотеки для инсталляции. Поэтому рекомендуется периодически проверить выход новых релизов и своевременно их устанавливать.
Наша группа в TelegramПолезные советы и помощь
pip — The Python Package Installer
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
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.
Как любой серьёзный язык программирования, 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
Try a faster way of installing Python packages for Windows. Build your own Python environment with the packages you need. Get started for free on the ActiveState Platform.
The Pip Package Manager is the de facto standard for managing Python distributions, and is recommended for installing Python packages for Windows.Pip is installed automatically with Python 2 (>=2.7.9) and Python 3 (>=3.4) installations. The pip command has options for installing, upgrading and deleting packages, and can be run from the Windows command line. By default, pip installs packages located in the Python Package Index (PyPI), but can also install from other indexes. For more information on how to use pip, see the Pip Package Installation instructions below.
Wheels and Windows
Python packages installed with pip on Windows are typically bundled into ‘wheels’ prior to installation. A wheel is a zip-style archive that contains all the files necessary for a typical package installation. Wheels have a .whl extension, and provide a simpler installation than ‘non-wheel’ packages.
Depending on the operating system that a package was built for and built on, the resulting wheel may not include file requirements for Windows. Appveyor offers a hosted continuous integration service that developers can use to package Python code for Windows deployments. Wheels built with Appveyor incorporate Windows support by default, and are usually recognizable by their name, e.g. packagename-2.8-cp37-cp37m-win_amd64.whl.
Installation Requirements
Before packages can be installed, ensure that your existing Python installation meets the requirements. Requirements will differ depending on whether you installed Python into a virtual environment using venv or virtualenv:
- Venv automatically installs pip into Python 3.4+ virtual environments
- Virtualenv automatically installs pip and wheel into Python 2.7+ and Python 3.3+ virtual environments
Note: If you’re using some form of enhanced shell such as IPython, then prefix the command with the ! character, e.g. !pip install <packagename>
- Verify that Python is installed:
Open a Windows command window and run the following command to check that a suitable Python version is installed:
python --version
Output should be similar to:
Python 3.6.6.
If Python is not installed, you can download a copy of ActiveState’s Python, ActivePython, for free.
- Verify that Pip is installed:
pip --version
Output should be similar to pip 19.3.1 from c:\python36\lib\site-packages\pip (python 3.6)
- Update Pip and Wheel to ensure you have the latest version installed:
pip install --upgrade pip wheel
Pip Package Installation
To install a package:
pip install <packagename>
To install a package from a repository other than PyPI, for instance, Github:
pip install -e git+<https://github.com/myrepo.git#egg=packagename>
To upgrade a package that is already installed:
pip install --upgrade <packagename>
To uninstall a package:
pip uninstall <packagename>
To show help for pip, including complete command usage and options:
pip -h pip --help
Pipenv
Pipenv is a new tool for managing dependencies. It uses pip and virtualenv under the hood, and simplifies their usage with a single command line syntax. Like venv, pipenv automatically creates a separate virtual environment for each project.
To install, upgrade or uninstall packages within pipenv, just replace the pip command with pipenv. For example, the following command installs a named package from PyPI:
pipenv install <packagename>
You can also install packages from locations other than PyPI. For example, the following command installs the requests package from a Github repository:
pipenv install -e git+https://github.com/requests/requests.git#egg=requests
Manual Package Installation
Most Python packages are now designed to be compatible with pip. If you have a package that’s not compatible, then you’ll need to do a manual installation.
How to manually install a Python package:
- Download the package and extract it into a local directory.
2a. If the package came with its own set of installation instructions, they should be followed.
2b. If not, then open a command window and cd into the directory, and enter:
python setup.py install
How ActiveState Can Help
ActiveState provides a unified cross-platform toolchain for modern Python package management. It can replace the complex and hard-to-maintain in-house solutions built from multiple package managers, environment management tools and other solutions.
By adopting the ActiveState Platform, developers can:
- Automated building of packages from source, including link C libraries without the need for a local build environment.
- Automated resolution of dependencies (or suggestions on how to manually resolve conflicts), ensuring that your environment always contains a set of known good dependencies that work together.
- Central management of a single source of truth for your environment that can be deployed with a single command to all development and CI/CD environments, ensuring consistent reproducibility.
- Automated installation of virtual Python environments on Windows or Linux without requiring prior setup.
- The ability to find, fix and automatically rebuild vulnerable environments, thereby enhancing security and dramatically reducing time and effort involved in resolving CVEs.
- Visually seeing which versions of which packages are approved for use, thereby taking the guesswork out of development.
Those that prefer to work from the command line can leverage the ActiveState Platform’s CLI, the State Tool, which acts as a universal package manager for Python, and provides access to most of the features offered by the Platform.
Modern Python Package Management
ActiveState provides a unified cross-platform toolchain for modern Python package management. It can replace the complex and hard-to-maintain in-house solutions built from multiple package managers, environment management tools and other solutions.
By adopting the ActiveState Platform, developers can:
- Increase the security of Python environments
- Improve the transparency of your open source supply chain
- Dramatically reduce package and environment management overhead
- Eliminate dependency hell
- Reduce “works on my machine” issues
Ultimately, developers that are willing to adopt the ActiveState Platform will spend less time wrestling with tooling and more time focused on doing what they do best: coding.
To try the ActiveState Platform for yourself, sign-up for a free account.
Related Links
View this page
Toggle table of contents sidebar
Usually, pip is automatically installed if you are:
-
working in a
virtual environment -
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 -
get-pip.py
ensurepip¶
Python comes with an ensurepip module[1], which can install pip in
a Python environment.
Linux
$ python -m ensurepip --upgrade
MacOS
$ python -m ensurepip --upgrade
Windows
C:> py -m ensurepip --upgrade
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.
-
Download the script, from https://bootstrap.pypa.io/get-pip.py.
-
Open a terminal/command prompt,
cdto the folder containing the
get-pip.pyfile and run:
More details about this script can be found in pypa/get-pip’s README.
Standalone zip application¶
Note
The zip application is currently experimental. We test that pip runs correctly
in this form, but it is possible that there could be issues in some situations.
We will accept bug reports in such cases, but for now the zip application should
not be used in production environments.
In addition to installing pip in your environment, pip is available as a
standalone zip application.
This can be downloaded from https://bootstrap.pypa.io/pip/pip.pyz. There are
also zip applications for specific pip versions, named pip-X.Y.Z.pyz.
The zip application can be run using any supported version of Python:
If run directly:
Linux
$ chmod +x ./pip.pyz $ ./pip.pyz
then the currently active Python interpreter will be used.
MacOS
$ chmod +x ./pip.pyz $ ./pip.pyz
then the currently active Python interpreter will be used.
Windows
then the currently active Python interpreter will be used.
You may need to configure your system to recognise the .pyz extension
before this will work.
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¶
Upgrade your pip by running:
Linux
$ python -m pip install --upgrade pip
MacOS
$ python -m pip install --upgrade pip
Windows
C:> py -m pip install --upgrade pip
Compatibility¶
The current version of pip works on:
-
Windows, Linux and macOS.
-
CPython 3.9, 3.10, 3.11, 3.12, 3.13, 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.
Other operating systems and Python versions are not supported by pip’s
maintainers.
Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.
