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,
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.
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.
Вариант 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Полезные советы и помощь
Pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party software packages with features and functionality not found in the Python standard library. Pip3 installs packages from PyPI (Python Package Index), but won’t resolve dependencies or help you solve dependency conflicts.
The ActiveState Platform’s command line interface, the State Tool will automatically resolve dependencies for you to ensure your Python environment won’t be corrupted by installing incompatible dependencies. Get started for free by creating an account on the ActiveState Platform or logging in with your GitHub account.
Install Pip3
pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party software packages with features and functionality not found in the Python standard library. Pip3 installs packages from PyPI (Python Package Index).
Installation Prerequisites
Check if pip3 is already installed by entering the following command in a terminal or command line:
pip3 -v
Output should be similar to:
Usage: C:\Python38\python.exe -m pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. ... ...
You can also check to see which version of pip3 is installed by entering:
pip3 --version
Output should be similar to:
pip 20.0.2 from C:\Python38\lib\site-packages\pip (python 3.8)
Confirm which version of Python (if any) is installed on your computer by entering:
python --version
Output should be similar to:
Python 3.8.2
Pip3 Installation
Python 3.4+ in most operating systems includes pip3 by default. If your python version is less than 3.4, then you should upgrade your Python version which will automatically install pip3.
For example, you can install the latest version of Python from ActiveState (Python 3.9), which includes pip3.
Pip3 Upgrade
In operating system environments that already have Python 3 and pip3 installations, you can upgrade pip3, by entering:
python -m pip3 install --upgrade pip
Pip3 Downgrade
You can downgrade to a previous version of pip3, in case a newer version is causing unexpected compatibility errors. For example, to downgrade to pip3 v19.0 run the following command:
python -m pip3 install pip==19.0
Pip3 Virtualenv and Venv
When pip3 is used in a virtual environment, it will generally install packages in a path similar to:
<virtualenv_name>/lib/<python_verion>/site-packages
Pip3 Usage
To install a Python package, enter:
Pip3 install <package_name>
Caution:
Linux and MacOS have system Python, that you should leave alone if possible. System Python is configured to help the operating system work as intended.
Install pip3 Ubuntu and Debian Linux
Ubuntu 18.04 has both Python 2 and Python 3 installed by default, and hence has two pip variants for each Python version. ‘pip’, refers to Python 2. pip3 refers to Python 3.
Ubuntu 20.4 has only Python 3, but still requires a separate python-pip 3 installation.
Procedure for installing pip3 on Ubuntu and Debian Linux:
Enter the following command to update Linux:
sudo apt update
Enter the following command to install pip3:
sudo apt install python3-pip
The above command will also install all pip3 dependencies.
To find the location where pip3 installs packages in Ubuntu Linux, enter:
which pip3
Output should be similar to:
/usr/bin/pip3
Install pip3 Windows
To install or upgrade pip3 in a Windows environment that already has Python 3 installed:
Download the latest version of get-pip.py from
<https://bootstrap.pypa.io/>
You can also use the curl command to download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
CD into the directory where get-pip.py was downloaded to, and enter the following command to install pip3 and its dependencies:
python3 get-pip.py
You can verify that pip3 is installed by navigating to the default pip3 installation directory, eg. C:\python38\scripts\, and enter:
pip3 --version
Add Pip3 to Windows Environment Variables
A common problem with running Python tools such as pip3 in Windows, is not having it in the environment path so that you can access it from anywhere. In most cases, you can navigate to the default <python_dir>/scripts directory in which the tool is installed in order to run it.
To run pip3 from any location, you need to add the directory in which it is installed in, as a System PATH environment variable:
- Open the Control Panel and navigate to System.
- Click on Advanced system settings in the upper left panel.
- Click on Environment Variables.
- Under System Variables, scroll down then double-click the PATH variable.
- Click New, and add the directory where pip3 is installed,
e.g.C:\Python38\Scripts , and select OK.
Figure 1: Environment Variables: Directory where pip3 is installed:
Install Pip3 MacOS
To install pip3 in a MacOS environment that already has Python 3 installed, enter:
sudo apt install python3-pip
To install pip3 using the Homebrew package manager (if it is installed), enter:
brew install pip3
You can also install pip3 using get-pip.py:
- Download the latest version of get-pip.py from https://bootstrap.pypa.io/.
- CD into the download directory, and enter the following command:
sudo python3 get-pip.py
get-pip.py will install pip3 for the python version which runs the script.
Pip3 and Conda
Pip3 has limited use in the Conda environment compared to other operating system environments.
Conda has many of the features found in pip3, but is otherwise a completely separate tool. It installs python modules and packages from the Anaconda Repository. Only after Conda has been used to install as many packages as possible in a project, should pip3 be used to install any remaining software.
It depends on whether you are familiar with pip3 and Conda, and with how package installations interact between the two methods. If you are relatively new to Conda and Python, then only use Conda to install packages in Conda environments. Otherwise pip3 can be used to install packages not found in the Anaconda Repository. Extra care needs to be taken with pip3 dependencies so that they do not conflict with Conda packages and dependencies.
If Python 3 and pip3 are installed outside of the Conda environment, then you can run pip3 from an Anaconda prompt just as you would from a Linux or Windows terminal or command line.
A modern solution to Python package management – Try ActiveState’s Platform
The ActiveState Platform is a cloud-based build tool for Python. It provides build automation and vulnerability remediation for:
- Python language cores, including Python 2.7 and Python 3.5+
- Python packages and their dependencies, including:
- Transitive dependencies (ie., dependencies of dependencies)
- Linked C and Fortran libraries, so you can build data science packages
- Operating system-level dependencies for Windows, Linux, and macOS
- Shared dependencies (ie., OpenSSL)
- Find, fix and automatically rebuild a secure version of Python packages like Django and environments in minutes
Python Package Management In Action
Get a hands-on appreciation for how the ActiveState Platform can help you manage your dependencies for Python environments. Just run the following command to install Python 3.9 and our package manager, the State Tool:
Windows
powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.www.activestate.com/dl/cli/install.ps1'))) -activate-default ActiveState-Labs/Python-3.9Beta"
Linux
sh <(curl -q https://platform.www.activestate.com/dl/cli/install.sh) --activate-default ActiveState-Labs/Python-3.9Beta
Now you can run state install <packagename>. Learn more about how to use the State Tool to manage your Python environment.
Let us know your experience in the ActiveState Community forum.
If you don’t have pip3 installed yet, follow the instructions for Installing Pip3 below.
If you think it might already be installed, you can scroll down to Verifying Pip3 to prove it.
If you are sure it’s installed, you can go straight to Configuring Pip3.
Download the 64-bit installer for python 3.6.5 by clicking here or visit the windows releases page for other versions.
The latest python3 installers for Windows install pip3 automatically but make sure that you have clicked the checkbox “Add Python 3.x to PATH” as shown in this screenshot…
Clicking the checkbox adds the folder containing python3 and pip3 to the ‘path’, (a list of folders which is searched by the Windows terminal cmd.exe
). This makes it easy to run pip3 commands from the terminal.
Verifying your Pip3 installation
On Windows you should be able to launch a Terminal, which looks like this..
After it has launched, type the following into the Terminal and press Enter
python
If python3 is installed this should launch the python shell, and take you to an interactive python prompt which looks like >>>
where you can type 4+4
, and press Enter to see 8
. Check that the version number starts with “Python 3”.
For example…
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> 4+4
8
If python
launched a python3 shell as expected, press CTRL+C to reset the prompt and type…
exit()
…then press Enter to leave the shell. Keep the terminal open, and proceed to configuring your pip3 install.
Troubleshooting
After installing any version of python you must close any existing cmd.exe window and open a new one to run python commands.
Go back to Installing Python3 if you encounter the following;
If python is not installed, the command will not launch a shell. It will instead report…
‘python’ is not recognized as an internal or external command, operable program or batch file.
If python2 is installed instead of python3 you might see instead…
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
Our Vanguard tools should run using python2 and can be installed using pip2 . However, Micropython is a dialect of python3 and the makers of python themselves will soon retire python2 so we recommend learners install and use python3 and pip3 following this advice at python.org.
After successfully installing Pip3, keep the terminal open, and proceed to configuring your pip3 install.
Утилита pip3 это официальный менеджер пакетов, и команда pip для Python 3. Она реализует установку и управление пакетов от сторонних разработчиков, что позволяет добавлять дополнительный функционал языка Python, которого нет в его стандартной библиотеке. Pip3 устанавливает пакеты из PyPI (Python Package Index).
[Предварительные требования]
Для начала проверьте, установлена ли у вас утилита pip3. Это делается следующей командой:
Вывод этой команды будет примерно такой (показана часть вывода команды на Windows):
c:\TEMP>pip3 -v
Usage:
pip3 < command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
inspect Inspect the python environment.
...
Также можно проверить, какая установлена версия pip3 и Python:
c:\TEMP>pip3 --version
pip 22.3 from C:\Python311\Lib\site-packages\pip (python 3.11)
Проверьте также, установлен ли Python:
c:\TEMP>python --version
Python 3.11.0
Установка pip3. По умолчанию любая версия Python, начиная с Python 3.4, уже включает в свою установку pip3. Если ваша версия python меньше 3.4, то сначала следует обновить версию Python, что автоматически установит pip3. Можно переустановить Python, скачав последний установочный пакет по ссылке [2].
Примечание: на компьютере может быть одновременно установлено несколько версий Python. Какая именно версия будет работать в ответ на команду python, зависит только от текущей настройки переменной окружения PATH.
Апгрейд pip3. На операционной системе, где уже ранее был установлен Python 3 и утилита pip3, вы может обновить pip3 вводом следующей команды:
python -m pip3 install --upgrade pip
python -m pip install --upgrade pip
C:\Program Files\Inkscape\bin\python.exe: No module named pip
Python сегодня используется в многих программах, поэтому если вы наблюдаете такую ошибку, то вероятно у вас урезанная версия python, которая была установлена вместе с какой-то программой (в примере сообщения выше это была программа графического редактора Inkscape).
Решить проблему можно легко, если просто установить полноценную версию Python, см. [2].
Понижение версии pip3. Можно сделать довнгрейд на предыдующую версию pip3 в случае, если более новая версия приводит к неожиданным ошибкам совместимости. Например, довнгрейд на pip3 версии v19.0 запускается следующей командой:
python -m pip3 install pip==19.0
Виртуальные окружения pip3 и venv. Когда pip3 используется в виртуальном окружении, он обычно установит пакеты в каталог примерно так:
< virtualenv_name>/lib/< python_verion>/site-packages
Как использовать pip3. Для установки пакета Python введите команду:
pip3 install < package_name>
Предупреждение: в операционных системах Linux и MacOS установлен системный Python (System Python), который по возможности надо оставить в покое. Системный Python сконфигурирован для помощи операционной системе, чтобы она работала, как было предусмотрено.
[Установка pip3 на Linux-системах Ubuntu и Debian]
На Ubuntu 18.04 по умолчанию установлены обе версии Python 2 и Python 3, поэтому здесь есть 2 варианта pip, каждый для своей версии Python. Команда pip относится к Python 2, а pip3 относится к Python 3.
На Ubuntu 20.4 установлена только версия Python 3, однако все еще требуется отдельная инсталляция pip3.
Процедура установки pip3 на Ubuntu и Debian:
1. Введите следующую команду для обновления Linux:
2. Введите следующую команду для установки pip3:
sudo apt install python3-pip
Эта команда также установит все необходимые зависимости pip3.
3. Чтобы найти место, куда pip3 устанавливает пакеты на Ubuntu Linux, введите команду:
Будет выведено наподобие следующего пути:
[Установка pip3 на Windows]
Для установки или обновления pip3 на Windows, где уже установлен Python 3:
1. Загрузите последнюю версию скрипта get-pip.py по ссылке [3]. Для загрузки get-pip.py также можно использовать команду curl:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2. Командой cd перейдите в каталог, куда скачали скрипт get-pip.py, и введите следующую команду для установки утилиты pip3 и её зависимостей:
3. Вы можете проверить, что pip3 установлена, если перейдете в директорию установки pip3 по умолчанию, например в каталог C:\python38\scripts\, и введете команду:
Добавление pip3 в переменные окружения Windows. Общая проблема с запуском утилит Python на Windows, таких как pip3, состоит в том, что до исполняемого кода утилит не прописан путь поиска в переменной окружения %PATH% (или прописан неправильный путь). В большинстве случаев вы можете перейти в каталог установки необходимой утилиты по умолчанию, например c:\Python38\scripts, чтобы иметь возможность запустить утилиту.
Чтобы можно было запускать команду pip3 из любого каталога, необходимо добавить директорию, куда установлена pip3, в системную переменную окружения %PATH%:
1. Откройте Панель управления -> Изменение системных переменных среды.
2. Кликните на кнопку «Переменные среды…».
3. Откроется оно для создания и изменения системных переменных и переменных пользователя. Найдите в списке системных переменных Path, и двойным щелчком на этой системной переменной откройте её редактирование.
4. Отобразится список из настроенных путей поиска запускаемых утилит. Кликните на кнопку «Создать», и добавьте директорию, куда была установлена утилита pip3, например C:\Python38\Scripts, и кликните OK.
5. Кнопкой «Вверх» переместите созданный путь в начало списка.
[Установка pip3 на MacOS]
Чтобы установить на MacOS, где уже установлен Python 3, введите команду:
sudo apt install python3-pip
Чтобы установить pip3 с помощью менеджера пакетов Homebrew (если он установлен), введите команду:
Также вы можете установить pip3 с помощью скрипта get-pip.py. Для этого загрузите его по ссылке [3], перейдите в директорию, куда загрузили, и введите команду:
Скрипт get-pip.py установит pip3 для той версии python, которая запустила скрипт.
[Утилита pip3 и Conda]
Утилита pip3 имеет ограниченное использование в окружении Conda по сравнению с другими рабочими средами операционных систем.
У Conda имеется множество функций, которые можно найти в pip3, но в основном Conda это совершенно другой инструмент. Conda устанавливает модули и пакеты python из репозитория Anaconda. Только после того, как Conda будет использована для установки как можно большего количества пакетов в проекте, следует использовать pip3 для установки любого остального программного обеспечения.
Все зависит от того, насколько вы знакомы с pip3 и Conda, и как установки пакетов взаимодействуют между этими двумя методами установки. Если вы относительный новичок в системах Conda и Python, тогда для установки пакетов в рабочих окружениях Conda используйте только Conda. Иначе для установки пакетов, которых нет в репозитории Anaconda, может быть случайно использована утилита pip3. Следует уделять дополнительное внимание с зависимостями pip3, чтобы они не конфликтовали с пакетами и зависимостями Conda.
Если Python 3 и pip3 установлены вне окружения Conda, то вы можете запускать pip3 из приглашения Anaconda точно так же, как в терминале Linux или командной строке Windows.
[Ссылки]
1. How To Install And Use Pip3 site:activestate.com.
2. Download the latest version Python site:python.org.
3. get-pip.py.