Как удалить библиотеку в python через pip windows

I'm trying to fix up one of my virtualenvs - I'd like to reset all of the installed libraries back to the ones that match production. Is there a quick and easy way to do this with pip?

I’m trying to fix up one of my virtualenvs — I’d like to reset all of the installed libraries back to the ones that match production.

Is there a quick and easy way to do this with pip?

Sathiamoorthy's user avatar

asked Jun 28, 2012 at 15:36

blueberryfields's user avatar

blueberryfieldsblueberryfields

43.8k27 gold badges87 silver badges167 bronze badges

2

I’ve found this snippet as an alternative solution. It’s a more graceful removal of libraries than remaking the virtualenv:

pip freeze | xargs pip uninstall -y

In case you have packages installed via VCS, you need to exclude those lines and remove the packages manually (elevated from the comments below):

pip freeze | grep -v "^-e" | xargs pip uninstall -y

If you have packages installed directly from github/gitlab, those will have @.
Like:

django @ git+https://github.com/django.git@<sha>

You can add cut -d "@" -f1 to get just the package name that is required to uninstall it.

pip freeze | cut -d "@" -f1 | xargs pip uninstall -y

Siddharth Prajosh's user avatar

answered Jun 28, 2012 at 18:32

blueberryfields's user avatar

blueberryfieldsblueberryfields

43.8k27 gold badges87 silver badges167 bronze badges

24

This will work for all Mac, Windows, and Linux systems.
To get the list of all pip packages in the requirements.txt file (Note: This will overwrite requirements.txt if exist else will create the new one, also if you don’t want to replace old requirements.txt then give different file name in the all following command in place requirements.txt).

pip freeze > requirements.txt

Now to remove one by one

pip uninstall -r requirements.txt

If we want to remove all at once then

pip uninstall -r requirements.txt -y

If you’re working on an existing project that has a requirements.txt file and your environment has diverged, simply replace requirements.txt from the above examples with toberemoved.txt. Then, once you have gone through the steps above, you can use the requirements.txt to update your now clean environment.

And For single command without creating any file (As @joeb suggested).

pip uninstall -y -r <(pip freeze)

answered Nov 12, 2016 at 18:08

Harshad Kavathiya's user avatar

13

I wanted to elevate this answer out of a comment section because it’s one of the most elegant solutions in the thread. Full credit for this answer goes to @joeb.

pip uninstall -y -r <(pip freeze)

This worked great for me for the use case of clearing my user packages folder outside the context of a virtualenv which many of the above answers don’t handle.

Edit: Anyone know how to make this command work in a Makefile?

Bonus: A bash alias

I add this to my bash profile for convenience:

alias pipuninstallall="pip uninstall -y -r <(pip freeze)"

Then run:

pipuninstallall

Alternative for Pipenv

If you are using pipenv, you can run:

pipenv uninstall --all

Alternative for Poetry

If you are using Poetry, run:

poetry env remove --python3.9

(Note that you need to change the version number there to match whatever your Python version is.)

answered Mar 9, 2018 at 18:51

Taylor D. Edmiston's user avatar

7

This works with the latest. I think it’s the shortest and most declarative way to do it.

virtualenv --clear MYENV

But why not just delete and recreate the virtualenv?

Immutability rules. Besides it’s hard to remember all those piping and grepping the other solutions use.

answered Jul 26, 2012 at 15:15

Robert Moskal's user avatar

Robert MoskalRobert Moskal

21.4k8 gold badges61 silver badges85 bronze badges

4

Other answers that use pip list or pip freeze must include --local else it will also uninstall packages that are found in the common namespaces.

So here are the snippet I regularly use

 pip freeze --local | xargs pip uninstall -y

Ref: pip freeze --help

answered Aug 3, 2017 at 4:49

nehem's user avatar

1

I managed it by doing the following:

  1. Create the requirements file called reqs.txt with currently installed packages list
pip freeze > reqs.txt
  1. Then uninstall all the packages from reqs.txt
# -y means remove the package without prompting for confirmation
pip uninstall -y -r reqs.txt

I like this method as you always have a pip requirements file to fall back on should you make a mistake. It’s also repeatable, and it’s cross-platform (Windows, Linux, MacOs).

answered Oct 29, 2019 at 11:32

K-Dawg's user avatar

K-DawgK-Dawg

2,8171 gold badge33 silver badges51 bronze badges

0

Method 1 (with pip freeze)

pip freeze | xargs pip uninstall -y

Method 2 (with pip list)

pip list | awk '{print $1}' | xargs pip uninstall -y

Method 3 (with virtualenv)

virtualenv --clear MYENV

blueberryfields's user avatar

answered Jun 5, 2016 at 13:25

Suriyaa's user avatar

SuriyaaSuriyaa

2,3622 gold badges25 silver badges45 bronze badges

3

On Windows if your path is configured correctly, you can use:

pip freeze > unins && pip uninstall -y -r unins && del unins

It should be a similar case for Unix-like systems:

pip freeze > unins && pip uninstall -y -r unins && rm unins

Just a warning that this isn’t completely solid as you may run into issues such as ‘File not found’ but it may work in some cases nonetheless

EDIT: For clarity: unins is an arbitrary file which has data written out to it when this command executes: pip freeze > unins

That file that it written in turn is then used to uninstall the aforementioned packages with implied consent/prior approval via pip uninstall -y -r unins

The file is finally deleted upon completion.

answered Dec 6, 2015 at 14:01

Richard Kenneth Niescior's user avatar

0

I use the —user option to uninstall all the packages installed in the user site.

pip3 freeze --user | xargs pip3 uninstall -y

Kermit's user avatar

Kermit

4,4584 gold badges39 silver badges69 bronze badges

answered Apr 1, 2020 at 7:56

Dean's user avatar

DeanDean

4914 silver badges8 bronze badges

5

For Windows users, this is what I use on Windows PowerShell

 pip uninstall -y (pip freeze)

answered Mar 23, 2018 at 12:57

benwrk's user avatar

benwrkbenwrk

3282 silver badges7 bronze badges

0

First, add all package to requirements.txt

pip freeze > requirements.txt

Then remove all

pip uninstall -y -r requirements.txt 

answered Jan 8, 2019 at 10:03

shafik's user avatar

shafikshafik

5,8725 gold badges35 silver badges47 bronze badges

0

The quickest way is to remake the virtualenv completely. I’m assuming you have a requirements.txt file that matches production, if not:

# On production:
pip freeze > reqs.txt

# On your machine:
rm $VIRTUALENV_DIRECTORY
mkdir $VIRTUALENV_DIRECTORY
pip install -r reqs.txt

dwlz's user avatar

dwlz

10.7k6 gold badges49 silver badges81 bronze badges

answered Jun 28, 2012 at 15:37

Ned Batchelder's user avatar

Ned BatchelderNed Batchelder

358k72 gold badges559 silver badges655 bronze badges

1

GabLeRoux's user avatar

GabLeRoux

15.9k14 gold badges62 silver badges79 bronze badges

answered Sep 10, 2016 at 4:50

zesk's user avatar

zeskzesk

3072 silver badges6 bronze badges

1

Its an old question I know but I did stumble across it so for future reference you can now do this:

pip uninstall [options] <package> ...
pip uninstall [options] -r <requirements file> ...

-r, —requirement file

Uninstall all the packages listed in the given requirements file. This option can be used multiple times.

from the pip documentation version 8.1

answered Mar 23, 2016 at 14:33

Craicerjack's user avatar

CraicerjackCraicerjack

6,1152 gold badges31 silver badges39 bronze badges

(adding this as an answer, because I do not have enough reputation to comment on @blueberryfields ‘s answer)

@blueberryfields ‘s answer works well, but fails if there is no package to uninstall (which can be a problem if this «uninstall all» is part of a script or makefile). This can be solved with xargs -r when using GNU’s version of xargs:

pip freeze --exclude-editable | xargs -r pip uninstall -y

from man xargs:

-r, —no-run-if-empty

If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there
is no input. This option is a GNU extension.

answered Jul 5, 2019 at 11:24

Thibaut Dubernet's user avatar

pip3 freeze --local | xargs pip3 uninstall -y

The case might be that one has to run this command several times to get an empty pip3 freeze --local.

answered Oct 17, 2019 at 18:26

obotezat's user avatar

obotezatobotezat

99615 silver badges20 bronze badges

1

Best way to remove all packages from the virtual environment.

Windows PowerShell:

pip freeze > unins ; pip uninstall -y -r unins ; del unins

Windows Command Prompt:

pip freeze > unins && pip uninstall -y -r unins && del unins

Linux:

pip3 freeze > unins ; pip3 uninstall -y -r unins ; rm unins

answered Sep 14, 2022 at 18:40

Sathiamoorthy's user avatar

SathiamoorthySathiamoorthy

7,0239 gold badges58 silver badges65 bronze badges

3

This was the easiest way for me to uninstall all python packages.

from pip import get_installed_distributions
from os import system
for i in get_installed_distributions():
    system("pip3 uninstall {} -y -q".format(i.key))

Huey's user avatar

Huey

5,0446 gold badges33 silver badges44 bronze badges

answered Jun 18, 2017 at 20:06

Anonymous 138's user avatar

the easy robust way
cross-platform
and work in pipenv as well is:

pip freeze 
pip uninstall -r requirement

by pipenv:

pipenv run pip freeze 
pipenv run pip uninstall -r requirement

but won’t update piplock or pipfile so be aware

answered Oct 11, 2019 at 18:10

Mahdi Hamzeh's user avatar

Cross-platform support by using only pip:

#!/usr/bin/env python

from sys import stderr
from pip.commands.uninstall import UninstallCommand
from pip import get_installed_distributions

pip_uninstall = UninstallCommand()
options, args = pip_uninstall.parse_args([
    package.project_name
    for package in
    get_installed_distributions()
    if not package.location.endswith('dist-packages')
])

options.yes = True  # Don't confirm before uninstall
# set `options.require_venv` to True for virtualenv restriction

try:
    print pip_uninstall.run(options, args)
except OSError as e:
    if e.errno != 13:
        raise e
    print >> stderr, "You lack permissions to uninstall this package.
                      Perhaps run with sudo? Exiting."
    exit(13)
# Plenty of other exceptions can be thrown, e.g.: `InstallationError`
# handle them if you want to.

answered Feb 21, 2015 at 3:45

Samuel Marks's user avatar

Samuel MarksSamuel Marks

1,37116 silver badges24 bronze badges

On Windows if your path is configured correctly, you can use:

pip freeze > unins && pip uninstall -y -r unins && del unins

Brian Tompsett - 汤莱恩's user avatar

answered Apr 19, 2021 at 18:53

Enayat Khan's user avatar

This works on my windows system

pip freeze > packages.txt && pip uninstall -y -r packages.txt && del packages.txt

The first part pip freeze > packages.txt creates a text file with list of packages installed using pip along with the version number

The second part pip uninstall -y -r packages.txt deletes all the packages installed without asking for a confirmation prompt.

The third part del packages.txt deletes the just now created packages.txt.

answered Jun 23, 2021 at 11:15

SohailAQ's user avatar

SohailAQSohailAQ

9421 gold badge12 silver badges24 bronze badges

This is the command that works for me:

pip list | awk '{print $1}' | xargs pip uninstall -y

answered Jun 2, 2016 at 22:12

Fei Xie's user avatar

Fei XieFei Xie

1071 silver badge2 bronze badges

If you’re running virtualenv:

virtualenv --clear </path/to/your/virtualenv>

for example, if your virtualenv is /Users/you/.virtualenvs/projectx, then you’d run:

virtualenv --clear /Users/you/.virtualenvs/projectx

if you don’t know where your virtual env is located, you can run which python from within an activated virtual env to get the path

answered Oct 27, 2016 at 21:57

punkrockpolly's user avatar

punkrockpollypunkrockpolly

8,7266 gold badges35 silver badges37 bronze badges

In Command Shell of Windows, the command pip freeze | xargs pip uninstall -y won’t work. So for those of you using Windows, I’ve figured out an alternative way to do so.

  1. Copy all the names of the installed packages of pip from the pip freeze command to a .txt file.
  2. Then, go the location of your .txt file and run the command pip uninstall -r *textfile.txt*

answered Dec 26, 2017 at 6:39

Sushant Chaudhary's user avatar

If you are using pew, you can use the wipeenv command:

pew wipeenv [env]

answered Jan 11, 2019 at 10:57

Mohammad Banisaeid's user avatar

I simply wanted to remove packages installed by the project, and not other packages I’ve installed (things like neovim, mypy and pudb which I use for local dev but are not included in the app requirements). So I did:

cat requirements.txt| sed 's/=.*//g' | xargs pip uninstall -y

which worked well for me.

answered Jan 20, 2021 at 23:39

verboze's user avatar

verbozeverboze

4191 gold badge7 silver badges10 bronze badges

Select Libraries To Delete From This Folder:

C:UsersUserAppDataLocalProgramsPythonPython310Libsite-packages

answered Dec 11, 2021 at 9:05

Erfan Maraghi's user avatar

1

Why not just rm -r .venv and start over?

answered Aug 12, 2022 at 18:15

Evan Zamir's user avatar

Evan ZamirEvan Zamir

7,85112 gold badges52 silver badges81 bronze badges

1

pip uninstall `pip freeze --user`

The --user option prevents system-installed packages from being included in the listing, thereby avoiding /usr/lib and distutils permission errors.

answered Jan 3 at 0:25

young_souvlaki's user avatar

young_souvlakiyoung_souvlaki

1,7674 gold badges21 silver badges27 bronze badges

1

Менеджер пакетов pip: разбираемся с установкой дополнительных библиотек в Python

Smartiqa Article

Если вы работаете с языком программирования Python, то не раз сталкивались с утилитой pip. Общение с этим пакетом для большинства начинающих программистов ограничивается командой install. Однако возможности менеджера пакетов существенно шире.

1. Предназначение менеджера пакетов pip

Ведь не все пакеты нужны в повседневной практике или отдельном проекте, да и места они занимают не мало. Для этих целей создан удаленный репозиторий модулей https://pypi.org/, в котором на сегодня имеется более 260 тыс. проектов на все случаи практики программирования. Вам не обязательно создавать код с нуля, так как под многие задачи уже имеется соответствующий пакет.

Работа с этим хранилищем расширений осуществляется через команду pip. Имеется и другой установщик easy_install, но он применяется существенно реже. Таким образом, пакетный менеджер pip необходим для установки, обновления, удаления и управления модулями языка Python.

2. Подготовительные мероприятия

Чтобы пользоваться возможностями пакетного менеджера pip, его необходимо установить. Если версия вашего Python выше 3.4 или 2.7.9, то pip уже интегрирован в него. Использование более ранних версий языка не рекомендуется (вы теряете часть функционала). Другой способ установить pip (если вы его удалили случайно):

Проверить, что в вашем проекте или на ПК доступен pip, можно применяя следующую команду —version или -V:

pip 20.2.3 from c:usersmikappdatalocalprogramspythonpython38-32libsite-packagespip (python 3.8)

Как видно из ответа, на данном ПК используется python версии 3.8 и pip версии 20.2.3.

В некоторых случаях (актуально для пользователей Linux или macOS) требуется применять команду pip3 (если в результате выполнения pip определяет, что у вас установлен python версии 2 по умолчанию). Это связано с тем, что на *nix системах присутствуют сразу обе версии языка.

Также если на вашем компьютере имеется несколько версий языка Python (например, 3.6, 3.8, 3.9), то менеджер пакетов может применяться отдельно для каждой из них:

После установки менеджера пакетов и определения его версии не следует забывать об его обновления до последнего издания. Для windows систем:

> python -m pip install -U pip

В результате выполнения команды мы получим сообщение об успешном обновлении pip до последнего релиза или сведения о том, что у нас уже установлена последняя версия.

3. Установка и удаление пакетов

Наиболее часто используемая команда в менеджере пакетов связана с непосредственной установкой необходимых модулей. Для примера установим библиотеку NumPy (позволяет эффективно работать с многомерными массивами и включает ряд соответствующих математических функций).

После выполнения команды данный модуль добавится в вашу библиотеку со всеми необходимыми дополнениями. Важно отметить, что будет загружена последняя версия NumPy. Бывают случаи, когда для проекта используется определенная версия пакета. Чтобы ничего не «сбилось», требуется установить именно этот релиз либо версию, которая не ниже определенной. Для этого применяются следующие команды:

pip install numpy==1.16.1
pip install numpy>=1.17.0

Имеются и другие операторы (>, < и т.п.). Даже если пакет уже установлен и работает некорректно можно принудительно его переустановить.

pip install --force-reinstall numpy

При разработке сложных проектов может понадобиться установка большого количества модулей. Постоянно их скачивать из репозитория PyPi трудоемко. Для этого разработан способ загрузки пакетов локально. Они могут находиться в архивах (*.tar.gz) или специальных файлах с расширением .whl. Это удобно и в том случае, если нет доступа в интернет у выбранной машины, и вы заранее создали пакет со всеми необходимыми библиотеками.

Для примера запакуем модуль numpy в «колесо» (wheel) и установим его оттуда.

pip wheel --wheel-dir=. numpy
pip install --no-index --find-links=. numpy

Вначале мы создали специальный локальный пакет NumPy и поместили его в текущую папку (о чем свидетельствует точка). В директории создался файл numpy-1.19.2-cp38-cp38-win32.whl. На его основании даже без интернета мы легко сможем установить данную библиотеку. Команда «—no-index» говорит о том, чтобы мы не искали модуль в репозитории PyPi, а —find-links принудительно указывает место расположения пакета. Когда речь идет о сотне пакетов, это очень удобно. Правда для этого необходимо освоить еще один инструмент: набор зависимостей (о нем – следующий раздел).

Рассмотрим вопрос удаления модулей. Если требуется удалить один пакет, то делается это по аналогии с установкой:

Для удаления нескольких модулей их можно перечислить через пробел или воспользоваться файлом requirements.txt. Чтобы при стирании библиотек постоянно не запрашивалось подтверждение от пользователя («введите Y для удаления или N для отмены»), применяется ключ -y или —yes.

pip uninstall –y pycryptodomex pyzipper
pip uninstall –y –r requirements.txt

К слову, при установке нового пакета или его обновлении старая версия удаляется из библиотеки конкретного окружения.

Читайте также

4. Файлы требований для управления пакетами

Серьезные и многоуровневые приложения никогда не обходятся одной библиотекой. Даже когда вы устанавливали тот же NumPy, вы могли заметить, что помимо самого модуля скачивались дополнительные пакеты, которые мы не запрашивали. Естественно они необходимы для правильной работы NumPy. Но откуда известно, что они нужны?

Для таких целей придумали файл зависимостей, в котором перечислены все требуемые библиотеки для работы конкретного проекта. Он создается в любом удобном месте (обычно его называют requirements.txt) и используется для развертывания приложения в новом окружении.

pip freeze > requirements.txt

Если открыть содержимое текстового документа, то обнаружим все зависимости (небольшой фрагмент последнего показан ниже):

…
bleach==3.2.1
cached-property==1.5.2
certifi==2020.6.20
cffi==1.14.3
chardet==3.0.4
colorama==0.4.4
cycler==0.10.0
…

В созданном при помощи команды freeze файле показаны модули проекта и их версии. Этот файл можно править вручную для задания дополнительных ограничений. Так, для пакета colorama можем приписать особые требования:

colorama>=0.2.0, <= 0.4.4

Этим мы даем понять, что тестировали работоспособность приложения на версиях от 0.2 до 0.4.4 включительно. Другие версии могут вызвать ошибки. После создания файла requirements.txt его можно использовать для установки всех требуемых модулей, не прописывая огромный список вручную.

pip install -r requirements.txt

Менеджер пакетов «заглянет» внутрь и скачает все библиотеки для проекта.

Также рассмотрим более сложный пример. Предположим, что наше приложение может функционировать в питоне версий 2 и 3. Разумеется, каждая из этих версий требует своего набора модулей. В requirements.txt все это можно прописать:

…
cached-property==1.5.2
certifi==2020.6.20 ; python_version < ‘3.6’
cffi==1.14.3 ; python_version >= '3.6'
chardet==3.0.4
…

Так, если у пользователя на компьютере установлен Python 3.5, то модуль cffi устанавливаться не будет. Подобный подход несколько портит красоту зависимостей, что ведет в ряде случаев к созданию дополнительного файла constraints.txt со списком ограничений. Он нужен для того, чтобы избегать установок лишних модулей в многоуровневых приложениях.

Приведем пример. Для работы нашего приложения требуются некоторые
модули определенных версий. Перечислим их в файле requirements.txt.

Django==3.1.2
django-allauth==0.32.0

Для данных библиотек имеются некоторые зависимости. В зависимости от того, на какой версии питона будет работать приложение, могут потребоваться разные модули. Так, python-openid работает только на питоне 2 версии, а python3-openid нужен для 3-ей версии. Все эти требования мы прописывает в requirements.txt, делая его нечитабельным и неудобным.

Django==3.1.2
django-allauth==0.32.0
oauthlib==3.1.0
python-openid==2.2.5 ; python_version < '3.0'
python3-openid==3.2.0; python_version >= '3.0'

Намного разумнее — создать constraints.txt, в котором прописываются дополнительные зависимости, а в файле requirements.txt перечислить основные библиотеки. Когда основные модули начнут подтягивать дополнительные, то они смогут понять, какие же версии им потребуются. Файлы примут такой вид:

Django==3.1.2
django-allauth==0.32.0

oauthlib==3.1.0
python-openid==2.2.5
python3-openid==3.2.0

Для установки всех требуемых модулей и их зависимостей применяется команда:

pip install -c constraints.txt

На практике constraints.txt используется лишь в крупных проектах, а для небольших разработок можно обойтись простым перечислением зависимостей.

Задачи по теме


Рассматриваем модули и пакеты из стандартной библиотеки Python и PyPI. Учимся использовать инструкции import и from..import и различать абсолютный и относительный импорт. Разбираемся с виртуальными пространствами venv. Создаем собственные модули.


Импорт библиотек в Python. Различие модулей и пакетов, причины их использования. Актуальные вопросы для проверки понимания темы и задание для самостоятельной практики.


5. Дополнительные команды pip

Наберем в командной строке

Перед нами предстанет перечень доступных команд в менеджере пакетов. По каждой команде также можно получить справочную информацию:

Команд и дополнительных ключей в pip имеется предостаточное количество. Ознакомиться с ними можно на сайте документации. Мы же рассмотрим основные команды и покажем их применение.

5.1. Команда download

Позволяет скачивать модули в указанную директорию для дальнейшего их использования локально (без повторного скачивания с репозитория).

# Устанавливаем модуль в текущую папку (получим файл с расширением «.whl»)
pip download numpy
# Загружаем NumPy в поддиректорию /mods/ (если ее нет, то она создастся)
pip download --destination-directory ./mods/ numpy
# В текущую папку скачаются все пакеты, указанные в файле зависимостей
pip download --destination-directory . –r requirements.txt
# Пример использования дополнительных команд (скачиваем библиотеку только для Линукс-систем и питона не ниже 3 версии)
pip download --platform linux_x86_64 --python-version 3 numpy

5.2. Команда list

Команда list позволяет просматривать все имеющиеся в виртуальном окружении или глобально модули с указанием их версий.

# Отображаем список всех установленных модулей
> pip list
Package    Version
---------- -------
numpy      1.19.0
pip        20.2.4
setuptools 50.3.2
# Отображаем список всех установленных модулей в формате json
> pip list --format json
[{"name": "numpy", "version": "1.19.0"}, {"name": "pip", "version": "20.2.4"}, {"name": "setuptools", "version": "50.3.2"}]
# Перечисляем модули, которые имеются в системе, но не связаны с другими (в ряде случаев таким способом можно выяснить модули, которые вам не нужны либо еще не используемые в проекте)
> pip list --not-required
Package    Version
---------- -------
numpy      1.19.0
# Выводим перечень библиотек, которые требуют обновления (для них вышла более новая версия)
> pip list –o
Package Version Latest Type
------- ------- ------ -----
numpy   1.19.0  1.19.2 wheel

5.3. Команда show

Показывает информацию о конкретном модуле или их группе.

# Вывод информации о библиотеке: версия, автор, описание, расположение, зависимости и т.д.
> pip show numpy
Name: numpy
Version: 1.19.0
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
...
# Самые полные сведения о модуле
> pip show --verbose numpy
…
Metadata-Version: 2.1
Installer: pip
Classifiers:
  Development Status :: 5 - Production/Stable
  Intended Audience :: Science/Research
...

5.4. Команда check

Нужна для проверки зависимостей, нехватки модулей или их неверной версии.

> pip check
No broken requirements found.

Если будут найдены ошибки, то выведется соответствующая информация.

5.5. Команда search

Дает возможность осуществлять поиск пакетов из командной строки.

> pip search numpy
numpy (1.19.2)                            - NumPy is the fundamental package for array computing with Python.
  INSTALLED: 1.19.0
  LATEST:    1.19.2
numpy-cloud (0.0.5)                       - Numpy in the cloud
numpy-alignments (0.0.2)                  - Numpy Alignments
numpy-utils (0.1.6)                       - NumPy utilities.
...

Показанный выше запрос выводит несколько десятков результатов. В их названии или описании имеется слово numpy. Поиск не так удобен, как через сайт репозитория, но иногда может быть полезен.

5.6. Команда hash

Вычисляет хеш локального модуля на основании определенного алгоритма (можно выбирать).

> pip hash numpy-1.19.2-cp38-cp38-win32.whl
numpy-1.19.2-cp38-cp38-win32.whl:--hash=sha256:51ee93e1fac3fe08ef54ff1c7f329db64d8a9c5557e6c8e908be9497ac76374b

Может понадобиться для проверки полноты скачивания модуля.

5.7. Команда cache

Предоставляет сведения о кеше менеджера пакетов и позволяет оперировать им.

# Очистка кеша и удаление всех whl-файлов
> pip cache purge
# Показать папку с кеш-файлами менеджера пакетов
> pip cache dir
c:usersmmmappdatalocalpipcache
# Узнать размер, место расположения и количество файлов в директории кеша
> pip cache info
Location: c:usersmmmappdatalocalpipcachewheels
Size: 0 bytes
Number of wheels: 0

5.8. Команда debug

Отражает отладочную информацию: о версии пайтона, менеджера пакетов, модулях, операционной системе и т.п.

> pip debug
pip version: pip 20.2.4 from d:1tmpvenvlibsite-packagespip (python 3.8)
sys.version: 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
sys.executable: d:1tmpvenvscriptspython.exe
sys.getdefaultencoding: utf-8
...

Сведения могут понадобиться при ошибках и сбоях в работе модулей или установщика.

5.9. Команда completion

Команда актуальная для пользователей *nix систем, чтобы в оболочке bash получить возможность автодополнения команд. Другими словами, при нажатии TAB вы сможете набрать первые 1-2 буквы команды, а остальное определится системой.

$ pip completion --bash >> ~/.profile

Фактически, вы дополняете профиль командной оболочки командами менеджера пакетов.

5.10. Команда config

Управление файлом настроек пакета модулей (pip.ini). Нужно быть аккуратнее, чтобы ничего не сломать в работе питона. Вмешиваться в настройки может понадобиться в случаях наличия нескольких пользователей в вашей операционной системе и при потребности их разграничить в средах программирования.

> pip config list
# При вызове команды получаем содержимое файла pip.ini, который расположен либо в домашней директории, либо в папке виртуального окружения. 
global.require-virtualenv='true'
global.user='false'

Зачастую при установке новых пакетов могут возникать ошибки доступа или ограниченных прав того или иного пользователя. Правильное конфигурирование pip позволяет избежать многих проблем.

Менеджер пакетов языка python обладает целым рядом полезных команд. Он позволяет не только устанавливать / удалять библиотеки из официального репозитория, локальных дисков и папок, но и дает возможности организации управления модулями и их версиями при работе над проектами.

Как вам материал?

Читайте также

All Python package management solutions provide the basic function of uninstalling packages, including pip, pipenv and the ActiveState Platform. However, unless specifically defined in a requirements.txt or pipfile.lock, package managers will not deal with transitive dependencies (ie., dependencies of dependencies).

In this article, we explain how to uninstall Python packages using these popular tools and we also introduce you to the ActiveState Platform. The AS Platform is unique in automatically installing and uninstalling transitive dependencies. Our dependency management system makes it possible to track conflicts between packages, know about platform-specific dependencies, and even track system-level dependencies like C and C++ libraries. Once you are done reading, you can try the ActiveState Platform by signing up for a free account.

Read on to understand how to work with Pip and Pipenv Package Managers to uninstall Python packages.

Checklist

Before packages can be uninstalled, ensure that a Python installation containing the necessary files needed for uninstalling packages is in place. Installation Requirements (for Windows).

How to Uninstall Packages Installed with Pip

To uninstall a package: 

pip uninstall <packagename>

How to Uninstall Packages in a Python Virtual Environment

Packages can be uninstalled from a virtual environment using pip or pipenv. 

To use pip to uninstall a package locally in a virtual environment:

  1. Open a command or terminal window (depending on the operating system) 
  2. cd into the project directory
  3. pip uninstall <packagename>

To use pipenv to uninstall a package locally in a virtual environment created with venv or virtualenv:

  1. Open a command or terminal window (depending on the operating system) 
  2. cd into the project directory
  3. pipenv uninstall <packagename>

How to Globally Uninstall Python Packages

In some cases, packages may be installed both locally (e.g., for use in a specific project) and system-wide. To ensure a package is completely removed from your system after you’ve uninstalled it locally, you’ll also need to uninstall it globally.

To uninstall a package globally in Windows: 

    1. Open a command window by entering ‘cmd’ in the Search Box of the Task bar
    2. Press Ctrl+Shift+Enter to gain Administration (Admin) privileges
    3. pip uninstall <packagename>

To uninstall a package globally in Linux:

    1. Open a terminal window
    2. sudo su pip uninstall <packagename>

How to Uninstall Package Dependencies with Pip

When you install a package with pip, it also installs all of the dependencies the package requires. Unfortunately, pip does not uninstall dependencies when you uninstall the original package. Here are a couple of different procedures that can be used to uninstall dependencies.

  1. If a package has been installed via a pip requirements file (i.e., pip install requirements.txt), all of the packages in requirements.txt can be uninstalled with the following command:
pip uninstall requirements.txt
  1. If a requirements.txt file is not available, you can use the pip show command to output all the requirements of a specified package:
pip show <packagename>

Example:

pip show cryptography

Output should be similar to: 

'Requires: six, cffi'

These dependencies can then be uninstalled with the pip uninstall command. However before uninstalling, you should ensure that the packages are NOT dependencies for other existing packages.

How to Uninstall Package Dependencies with Pipenv

To uninstall all the dependencies in a Pipenv project: 

  1. Open a command or terminal window
  2. cd into the project directory
  3. pipenv uninstall --all

How to Uninstall a Package Installed With Setuptools

Any packages that have been configured and installed with setuptools used the following command: 

python setup.py install 

Unfortunately, there is no python setup.py uninstall command. To uninstall a package installed with setup.py, use the pip command:

pip uninstall <packagename>

Be aware that there are a few exceptions that cannot be uninstalled with pip, including:

  • Distutils packages, which do not provide metadata indicating which files were installed.
  • Script wrappers installed by the setup.py develop command.

Next Steps

Resolving packages when installing or uninstalling an environment can be an extremely slow (or even manual) process. You can speed things up considerably using the ActiveState Platform, which automatically resolves dependencies for you–fast! Get started free on the ActiveState Platform.

Or just install Python 3.9 and use the included command line interface, the State Tool, to “state install” the packages you need:

>state install numpy

╔════════════════════╗
║ Installing Package ║
╚════════════════════╝

Updating Runtime

────────────────

Changes to your runtime may require some dependencies to be rebuilt.

numpy includes 2 dependencies, for a combined total of 8 new dependencies. 

Building                                    8/8

Installing                                  8/8

Package added: numpy

Python 3.9 Web GUI Graphic

There is a --user option for pip which can install a Python package per user:

pip install --user [python-package-name]

I used this option to install a package on a server for which I do not have root access. What I need now is to uninstall the installed package on the current user. I tried to execute this command:

pip uninstall --user [python-package-name]

But I got:

no such option: --user

How can I uninstall a package that I installed with pip install --user, other than manually finding and deleting the package?

I’ve found this article

pip cannot uninstall from per-user site-packages directory

which describes that uninstalling packages from user directory does not supported. According to the article if it was implemented correctly then with

pip uninstall [package-name]

the package that was installed will be also searched in user directories. But a problem still remains for me. What if the same package was installed both system-wide and per-user?
What if someone needs to target a specific user directory?

YaOzI's user avatar

YaOzI

14.9k7 gold badges72 silver badges71 bronze badges

asked Oct 29, 2015 at 11:27

Serjik's user avatar

5

Having tested this using Python 3.5 and pip 7.1.2 on Linux, the situation appears to be this:

  • pip install --user somepackage installs to $HOME/.local, and uninstalling it does work using pip uninstall somepackage.

  • This is true whether or not somepackage is also installed system-wide at the same time.

  • If the package is installed at both places, only the local one will be uninstalled. To uninstall the package system-wide using pip, first uninstall it locally, then run the same uninstall command again, with root privileges.

  • In addition to the predefined user install directory, pip install --target somedir somepackage will install the package into somedir. There is no way to uninstall a package from such a place using pip. (But there is a somewhat old unmerged pull request on Github that implements pip uninstall --target.)

  • Since the only places pip will ever uninstall from are system-wide and predefined user-local, you need to run pip uninstall as the respective user to uninstall from a given user’s local install directory.

answered Feb 20, 2016 at 14:20

Thomas Lotze's user avatar

Thomas LotzeThomas Lotze

5,0531 gold badge15 silver badges16 bronze badges

5

example to uninstall package ‘oauth2client’ on MacOS:

pip uninstall oauth2client

answered Mar 6, 2017 at 13:16

Huy - Logarit's user avatar

2

Be careful though, for those who using pip install --user some_pkg inside a virtual environment.

$ path/to/python -m venv ~/my_py_venv
$ source ~/my_py_venv/bin/activate
(my_py_venv) $ pip install --user some_pkg
(my_py_venv) $ pip uninstall some_pkg
WARNING: Skipping some_pkg as it is not installed.
(my_py_venv) $ pip list
# Even `pip list` will not properly list the `some_pkg` in this case

In this case, you have to deactivate the current virtual environment, then use the corresponding python/pip executable to list or uninstall the user site packages:

(my_py_venv) $ deactivate
$ path/to/python -m pip list
$ path/to/python -m pip uninstall some_pkg

Note that this issue was reported few years ago. And it seems that the current conclusion is: --user is not valid inside a virtual env’s pip, since a user location doesn’t really make sense for a virtual environment.

answered Jul 9, 2019 at 8:26

YaOzI's user avatar

YaOzIYaOzI

14.9k7 gold badges72 silver badges71 bronze badges

2

I strongly recommend you to use virtual environments for python package installation. With virtualenv, you prevent any package conflict and total isolation from your python related userland commands.

To delete all your package installed globally follow this;

It’s possible to uninstall packages installed with --user flag. This one worked for me;

pip freeze --user | xargs pip uninstall -y

For python 3;

pip3 freeze --user | xargs pip3 uninstall -y

But somehow these commands don’t uninstall setuptools and pip. After those commands (if you really want clean python) you may delete them with;

pip uninstall setuptools && pip uninstall pip

Now you have clean python environment. You can create virtualenv and install the package inside them.

answered Oct 28, 2019 at 19:23

thiras's user avatar

thirasthiras

4811 gold badge5 silver badges21 bronze badges

4

The answer is Not possible yet. You have to remove it manually.

answered Feb 20, 2016 at 15:32

sorin's user avatar

sorinsorin

157k172 gold badges522 silver badges784 bronze badges

3

As @thomas-lotze has mentioned, currently pip tooling does not do that as there is no corresponding —user option. But what I find is that I can check in ~/.local/bin and look for the specific pip#.# which looks to me like it corresponds to the —user option.

In my case:

antho@noctil: ~/.l/bin$ pwd
/home/antho/.local/bin
antho@noctil: ~/.l/bin$ ls pip*
pip  pip2  pip2.7  pip3  pip3.5

And then just uninstall with the specific pip version.

a different ben's user avatar

answered Aug 17, 2017 at 20:15

AnthonyC's user avatar

AnthonyCAnthonyC

1,8602 gold badges19 silver badges27 bronze badges

1

I am running Anaconda version 4.3.22 and a python3.6.1 environment, and had this problem. Here’s the history and the fix:

pip uninstall opencv-python # -- the original step. failed.

ImportError: DLL load failed: The specified module could not be found.

I did this into my python3.6 environment and got this error.

python -m pip install opencv-python # same package as above.
conda install -c conda-forge opencv # separate install parallel to opencv
pip-install opencv-contrib-python # suggested by another user here. doesn't resolve it.

Next, I tried downloading python3.6 and putting the python3.dll in the folder and in various folders. nothing changed.

finally, this fixed it:

pip uninstall opencv-python

(the other conda-forge version is still installed) This left only the conda version, and that works in 3.6.

>>>import cv2
>>>

working!

answered Sep 14, 2018 at 1:24

Marc Maxmeister's user avatar

Marc MaxmeisterMarc Maxmeister

3,9674 gold badges38 silver badges50 bronze badges

There is a --user option for pip which can install a Python package per user:

pip install --user [python-package-name]

I used this option to install a package on a server for which I do not have root access. What I need now is to uninstall the installed package on the current user. I tried to execute this command:

pip uninstall --user [python-package-name]

But I got:

no such option: --user

How can I uninstall a package that I installed with pip install --user, other than manually finding and deleting the package?

I’ve found this article

pip cannot uninstall from per-user site-packages directory

which describes that uninstalling packages from user directory does not supported. According to the article if it was implemented correctly then with

pip uninstall [package-name]

the package that was installed will be also searched in user directories. But a problem still remains for me. What if the same package was installed both system-wide and per-user?
What if someone needs to target a specific user directory?

YaOzI's user avatar

YaOzI

14.9k7 gold badges72 silver badges71 bronze badges

asked Oct 29, 2015 at 11:27

Serjik's user avatar

5

Having tested this using Python 3.5 and pip 7.1.2 on Linux, the situation appears to be this:

  • pip install --user somepackage installs to $HOME/.local, and uninstalling it does work using pip uninstall somepackage.

  • This is true whether or not somepackage is also installed system-wide at the same time.

  • If the package is installed at both places, only the local one will be uninstalled. To uninstall the package system-wide using pip, first uninstall it locally, then run the same uninstall command again, with root privileges.

  • In addition to the predefined user install directory, pip install --target somedir somepackage will install the package into somedir. There is no way to uninstall a package from such a place using pip. (But there is a somewhat old unmerged pull request on Github that implements pip uninstall --target.)

  • Since the only places pip will ever uninstall from are system-wide and predefined user-local, you need to run pip uninstall as the respective user to uninstall from a given user’s local install directory.

answered Feb 20, 2016 at 14:20

Thomas Lotze's user avatar

Thomas LotzeThomas Lotze

5,0531 gold badge15 silver badges16 bronze badges

5

example to uninstall package ‘oauth2client’ on MacOS:

pip uninstall oauth2client

answered Mar 6, 2017 at 13:16

Huy - Logarit's user avatar

2

Be careful though, for those who using pip install --user some_pkg inside a virtual environment.

$ path/to/python -m venv ~/my_py_venv
$ source ~/my_py_venv/bin/activate
(my_py_venv) $ pip install --user some_pkg
(my_py_venv) $ pip uninstall some_pkg
WARNING: Skipping some_pkg as it is not installed.
(my_py_venv) $ pip list
# Even `pip list` will not properly list the `some_pkg` in this case

In this case, you have to deactivate the current virtual environment, then use the corresponding python/pip executable to list or uninstall the user site packages:

(my_py_venv) $ deactivate
$ path/to/python -m pip list
$ path/to/python -m pip uninstall some_pkg

Note that this issue was reported few years ago. And it seems that the current conclusion is: --user is not valid inside a virtual env’s pip, since a user location doesn’t really make sense for a virtual environment.

answered Jul 9, 2019 at 8:26

YaOzI's user avatar

YaOzIYaOzI

14.9k7 gold badges72 silver badges71 bronze badges

2

I strongly recommend you to use virtual environments for python package installation. With virtualenv, you prevent any package conflict and total isolation from your python related userland commands.

To delete all your package installed globally follow this;

It’s possible to uninstall packages installed with --user flag. This one worked for me;

pip freeze --user | xargs pip uninstall -y

For python 3;

pip3 freeze --user | xargs pip3 uninstall -y

But somehow these commands don’t uninstall setuptools and pip. After those commands (if you really want clean python) you may delete them with;

pip uninstall setuptools && pip uninstall pip

Now you have clean python environment. You can create virtualenv and install the package inside them.

answered Oct 28, 2019 at 19:23

thiras's user avatar

thirasthiras

4811 gold badge5 silver badges21 bronze badges

4

The answer is Not possible yet. You have to remove it manually.

answered Feb 20, 2016 at 15:32

sorin's user avatar

sorinsorin

157k172 gold badges522 silver badges784 bronze badges

3

As @thomas-lotze has mentioned, currently pip tooling does not do that as there is no corresponding —user option. But what I find is that I can check in ~/.local/bin and look for the specific pip#.# which looks to me like it corresponds to the —user option.

In my case:

antho@noctil: ~/.l/bin$ pwd
/home/antho/.local/bin
antho@noctil: ~/.l/bin$ ls pip*
pip  pip2  pip2.7  pip3  pip3.5

And then just uninstall with the specific pip version.

a different ben's user avatar

answered Aug 17, 2017 at 20:15

AnthonyC's user avatar

AnthonyCAnthonyC

1,8602 gold badges19 silver badges27 bronze badges

1

I am running Anaconda version 4.3.22 and a python3.6.1 environment, and had this problem. Here’s the history and the fix:

pip uninstall opencv-python # -- the original step. failed.

ImportError: DLL load failed: The specified module could not be found.

I did this into my python3.6 environment and got this error.

python -m pip install opencv-python # same package as above.
conda install -c conda-forge opencv # separate install parallel to opencv
pip-install opencv-contrib-python # suggested by another user here. doesn't resolve it.

Next, I tried downloading python3.6 and putting the python3.dll in the folder and in various folders. nothing changed.

finally, this fixed it:

pip uninstall opencv-python

(the other conda-forge version is still installed) This left only the conda version, and that works in 3.6.

>>>import cv2
>>>

working!

answered Sep 14, 2018 at 1:24

Marc Maxmeister's user avatar

Marc MaxmeisterMarc Maxmeister

3,9674 gold badges38 silver badges50 bronze badges

User Guide

Running pip

pip is a command line program. When you install pip, a pip command is added
to your system, which can be run from the command prompt as follows:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip <pip arguments>

   ``python -m pip`` executes pip using the Python interpreter you
   specified as python. So ``/usr/bin/python3.7 -m pip`` means
   you are executing pip for your interpreter located at ``/usr/bin/python3.7``.

.. tab:: Windows

   .. code-block:: shell

      py -m pip <pip arguments>

   ``py -m pip`` executes pip using the latest Python interpreter you
   have installed. For more details, read the `Python Windows launcher`_ docs.


Installing Packages

pip supports installing from PyPI, version control, local projects, and
directly from distribution files.

The most common scenario is to install from PyPI using :ref:`Requirement
Specifiers`

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install SomePackage            # latest version
      python -m pip install SomePackage==1.0.4     # specific version
      python -m pip install 'SomePackage>=1.0.4'     # minimum version

.. tab:: Windows

   .. code-block:: shell

      py -m pip install SomePackage            # latest version
      py -m pip install SomePackage==1.0.4     # specific version
      py -m pip install 'SomePackage>=1.0.4'   # minimum version

For more information and examples, see the :ref:`pip install` reference.

Basic Authentication Credentials

This is now covered in :doc:`topics/authentication`.

netrc Support

This is now covered in :doc:`topics/authentication`.

Keyring Support

This is now covered in :doc:`topics/authentication`.

Using a Proxy Server

When installing packages from PyPI, pip requires internet access, which
in many corporate environments requires an outbound HTTP proxy server.

pip can be configured to connect through a proxy server in various ways:

  • using the --proxy command-line option to specify a proxy in the form
    scheme://[user:passwd@]proxy.server:port
  • using proxy in a :ref:`config-file`
  • by setting the standard environment-variables http_proxy, https_proxy
    and no_proxy.
  • using the environment variable PIP_USER_AGENT_USER_DATA to include
    a JSON-encoded string in the user-agent variable used in pip’s requests.

Requirements Files

«Requirements files» are files containing a list of items to be
installed using :ref:`pip install` like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install -r requirements.txt

Details on the format of the files are here: :ref:`requirements-file-format`.

Logically, a Requirements file is just a list of :ref:`pip install` arguments
placed in a file. Note that you should not rely on the items in the file being
installed by pip in any particular order.

In practice, there are 4 common uses of Requirements files:

  1. Requirements files are used to hold the result from :ref:`pip freeze` for the
    purpose of achieving :doc:`topics/repeatable-installs`. In
    this case, your requirement file contains a pinned version of everything that
    was installed when pip freeze was run.

    .. tab:: Unix/macOS
    
       .. code-block:: shell
    
          python -m pip freeze > requirements.txt
          python -m pip install -r requirements.txt
    
    
    .. tab:: Windows
    
       .. code-block:: shell
    
          py -m pip freeze > requirements.txt
          py -m pip install -r requirements.txt
    
    
  2. Requirements files are used to force pip to properly resolve dependencies.
    pip 20.2 and earlier doesn’t have true dependency resolution, but instead simply uses the first
    specification it finds for a project. E.g. if pkg1 requires
    pkg3>=1.0 and pkg2 requires pkg3>=1.0,<=2.0, and if pkg1 is
    resolved first, pip will only use pkg3>=1.0, and could easily end up
    installing a version of pkg3 that conflicts with the needs of pkg2.
    To solve this problem, you can place pkg3>=1.0,<=2.0 (i.e. the correct
    specification) into your requirements file directly along with the other top
    level requirements. Like so:

    pkg1
    pkg2
    pkg3>=1.0,<=2.0
    
  3. Requirements files are used to force pip to install an alternate version of a
    sub-dependency. For example, suppose ProjectA in your requirements file
    requires ProjectB, but the latest version (v1.3) has a bug, you can force
    pip to accept earlier versions like so:

    ProjectA
    ProjectB<1.3
    
  4. Requirements files are used to override a dependency with a local patch that
    lives in version control. For example, suppose a dependency
    SomeDependency from PyPI has a bug, and you can’t wait for an upstream
    fix.
    You could clone/copy the src, make the fix, and place it in VCS with the tag
    sometag. You’d reference it in your requirements file with a line like
    so:

    git+https://myvcs.com/some_dependency@sometag#egg=SomeDependency
    

    If SomeDependency was previously a top-level requirement in your
    requirements file, then replace that line with the new line. If
    SomeDependency is a sub-dependency, then add the new line.

It’s important to be clear that pip determines package dependencies using
install_requires metadata,
not by discovering requirements.txt files embedded in projects.

See also:

  • :ref:`requirements-file-format`
  • :ref:`pip freeze`
  • «setup.py vs requirements.txt» (an article by Donald Stufft)

Constraints Files

Constraints files are requirements files that only control which version of a
requirement is installed, not whether it is installed or not. Their syntax and
contents is a subset of :ref:`Requirements Files`, with several kinds of syntax
not allowed: constraints must have a name, they cannot be editable, and they
cannot specify extras. In terms of semantics, there is one key difference:
Including a package in a constraints file does not trigger installation of the
package.

Use a constraints file like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install -c constraints.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install -c constraints.txt

Constraints files are used for exactly the same reason as requirements files
when you don’t know exactly what things you want to install. For instance, say
that the «helloworld» package doesn’t work in your environment, so you have a
local patched version. Some things you install depend on «helloworld», and some
don’t.

One way to ensure that the patched version is used consistently is to
manually audit the dependencies of everything you install, and if «helloworld»
is present, write a requirements file to use when installing that thing.

Constraints files offer a better way: write a single constraints file for your
organisation and use that everywhere. If the thing being installed requires
«helloworld» to be installed, your fixed version specified in your constraints
file will be used.

Constraints file support was added in pip 7.1. In :ref:`Resolver
changes 2020`
we did a fairly comprehensive overhaul, removing several
undocumented and unsupported quirks from the previous implementation,
and stripped constraints files down to being purely a way to specify
global (version) limits for packages.

Installing from Wheels

«Wheel» is a built, archive format that can greatly speed installation compared
to building and installing from source archives. For more information, see the
Wheel docs , PEP 427, and PEP 425.

pip prefers Wheels where they are available. To disable this, use the
:ref:`—no-binary <install_—no-binary>` flag for :ref:`pip install`.

If no satisfactory wheels are found, pip will default to finding source
archives.

To install directly from a wheel archive:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install SomePackage-1.0-py2.py3-none-any.whl

.. tab:: Windows

   .. code-block:: shell

      py -m pip install SomePackage-1.0-py2.py3-none-any.whl

To include optional dependencies provided in the provides_extras
metadata in the wheel, you must add quotes around the install target
name:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install './somepackage-1.0-py2.py3-none-any.whl[my-extras]'

.. tab:: Windows

   .. code-block:: shell

      py -m pip install './somepackage-1.0-py2.py3-none-any.whl[my-extras]'

Note

In the future, the path[extras] syntax may become deprecated. It is
recommended to use PEP 508 syntax wherever possible.

For the cases where wheels are not available, pip offers :ref:`pip wheel` as a
convenience, to build wheels for all your requirements and dependencies.

:ref:`pip wheel` requires the wheel package to be installed, which provides the
«bdist_wheel» setuptools extension that it uses.

To build wheels for your requirements and all their dependencies to a local
directory:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install wheel
      python -m pip wheel --wheel-dir=/local/wheels -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install wheel
      py -m pip wheel --wheel-dir=/local/wheels -r requirements.txt

And then to install those requirements just using your local directory of
wheels (and not from PyPI):

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --no-index --find-links=/local/wheels -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --no-index --find-links=/local/wheels -r requirements.txt


Uninstalling Packages

pip is able to uninstall most packages like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip uninstall SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip uninstall SomePackage


pip also performs an automatic uninstall of an old version of a package
before upgrading to a newer version.

For more information and examples, see the :ref:`pip uninstall` reference.

Listing Packages

To list installed packages:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip list
      docutils (0.9.1)
      Jinja2 (2.6)
      Pygments (1.5)
      Sphinx (1.1.2)

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip list
      docutils (0.9.1)
      Jinja2 (2.6)
      Pygments (1.5)
      Sphinx (1.1.2)


To list outdated packages, and show the latest version available:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip list --outdated
      docutils (Current: 0.9.1 Latest: 0.10)
      Sphinx (Current: 1.1.2 Latest: 1.1.3)

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip list --outdated
      docutils (Current: 0.9.1 Latest: 0.10)
      Sphinx (Current: 1.1.2 Latest: 1.1.3)

To show details about an installed package:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip show sphinx
      ---
      Name: Sphinx
      Version: 1.1.3
      Location: /my/env/lib/pythonx.x/site-packages
      Requires: Pygments, Jinja2, docutils

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip show sphinx
      ---
      Name: Sphinx
      Version: 1.1.3
      Location: /my/env/lib/pythonx.x/site-packages
      Requires: Pygments, Jinja2, docutils

For more information and examples, see the :ref:`pip list` and :ref:`pip show`
reference pages.

Searching for Packages

pip can search PyPI for packages using the pip search
command:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip search "query"

.. tab:: Windows

   .. code-block:: shell

      py -m pip search "query"

The query will be used to search the names and summaries of all
packages.

For more information and examples, see the :ref:`pip search` reference.

Configuration

This is now covered in :doc:`topics/configuration`.

Config file

This is now covered in :doc:`topics/configuration`.

Environment Variables

This is now covered in :doc:`topics/configuration`.

Config Precedence

This is now covered in :doc:`topics/configuration`.

Command Completion

pip comes with support for command line completion in bash, zsh and fish.

To setup for bash:

python -m pip completion --bash >> ~/.profile

To setup for zsh:

python -m pip completion --zsh >> ~/.zprofile

To setup for fish:

python -m pip completion --fish > ~/.config/fish/completions/pip.fish

To setup for powershell:

python -m pip completion --powershell | Out-File -Encoding default -Append $PROFILE

Alternatively, you can use the result of the completion command directly
with the eval function of your shell, e.g. by adding the following to your
startup file:

eval "`pip completion --bash`"

Installing from local packages

In some cases, you may want to install from local packages only, with no traffic
to PyPI.

First, download the archives that fulfill your requirements:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip download --destination-directory DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip download --destination-directory DIR -r requirements.txt

Note that pip download will look in your wheel cache first, before
trying to download from PyPI. If you’ve never installed your requirements
before, you won’t have a wheel cache for those items. In that case, if some of
your requirements don’t come as wheels from PyPI, and you want wheels, then run
this instead:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip wheel --wheel-dir DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip wheel --wheel-dir DIR -r requirements.txt

Then, to install from local only, you’ll be using :ref:`—find-links
<install_—find-links>`
and :ref:`—no-index <install_—no-index>` like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --no-index --find-links=DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --no-index --find-links=DIR -r requirements.txt


«Only if needed» Recursive Upgrade

pip install --upgrade now has a --upgrade-strategy option which
controls how pip handles upgrading of dependencies. There are 2 upgrade
strategies supported:

  • eager: upgrades all dependencies regardless of whether they still satisfy
    the new parent requirements
  • only-if-needed: upgrades a dependency only if it does not satisfy the new
    parent requirements

The default strategy is only-if-needed. This was changed in pip 10.0 due to
the breaking nature of eager when upgrading conflicting dependencies.

It is important to note that --upgrade affects direct requirements (e.g.
those specified on the command-line or via a requirements file) while
--upgrade-strategy affects indirect requirements (dependencies of direct
requirements).

As an example, say SomePackage has a dependency, SomeDependency, and
both of them are already installed but are not the latest available versions:

  • pip install SomePackage: will not upgrade the existing SomePackage or
    SomeDependency.
  • pip install --upgrade SomePackage: will upgrade SomePackage, but not
    SomeDependency (unless a minimum requirement is not met).
  • pip install --upgrade SomePackage --upgrade-strategy=eager: upgrades both
    SomePackage and SomeDependency.

As an historic note, an earlier «fix» for getting the only-if-needed
behaviour was:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --upgrade --no-deps SomePackage
      python -m pip install SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --upgrade --no-deps SomePackage
      py -m pip install SomePackage


A proposal for an upgrade-all command is being considered as a safer
alternative to the behaviour of eager upgrading.

User Installs

With Python 2.6 came the «user scheme» for installation,
which means that all Python distributions support an alternative install
location that is specific to a user. The default location for each OS is
explained in the python documentation for the site.USER_BASE variable.
This mode of installation can be turned on by specifying the :ref:`—user
<install_—user>`
option to pip install.

Moreover, the «user scheme» can be customized by setting the
PYTHONUSERBASE environment variable, which updates the value of
site.USER_BASE.

To install «SomePackage» into an environment with site.USER_BASE customized to
‘/myappenv’, do the following:

.. tab:: Unix/macOS

   .. code-block:: shell

      export PYTHONUSERBASE=/myappenv
      python -m pip install --user SomePackage

.. tab:: Windows

   .. code-block:: shell

      set PYTHONUSERBASE=c:/myappenv
      py -m pip install --user SomePackage

pip install --user follows four rules:

  1. When globally installed packages are on the python path, and they conflict
    with the installation requirements, they are ignored, and not
    uninstalled.
  2. When globally installed packages are on the python path, and they satisfy
    the installation requirements, pip does nothing, and reports that
    requirement is satisfied (similar to how global packages can satisfy
    requirements when installing packages in a --system-site-packages
    virtualenv).
  3. pip will not perform a --user install in a --no-site-packages
    virtualenv (i.e. the default kind of virtualenv), due to the user site not
    being on the python path. The installation would be pointless.
  4. In a --system-site-packages virtualenv, pip will not install a package
    that conflicts with a package in the virtualenv site-packages. The —user
    installation would lack sys.path precedence and be pointless.

To make the rules clearer, here are some examples:

From within a --no-site-packages virtualenv (i.e. the default kind):

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip install --user SomePackage
      Can not perform a '--user' install. User site-packages are not visible in this virtualenv.


From within a --system-site-packages virtualenv where SomePackage==0.3
is already installed in the virtualenv:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage==0.4
      Will not install to the user site because it will lack sys.path precedence

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip install --user SomePackage==0.4
      Will not install to the user site because it will lack sys.path precedence

From within a real python, where SomePackage is not installed globally:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip install --user SomePackage
      [...]
      Successfully installed SomePackage

From within a real python, where SomePackage is installed globally, but
is not the latest version:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      $ python -m pip install --user --upgrade SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      C:> py -m pip install --user --upgrade SomePackage
      [...]
      Successfully installed SomePackage

From within a real python, where SomePackage is installed globally, and
is the latest version:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      $ python -m pip install --user --upgrade SomePackage
      [...]
      Requirement already up-to-date: SomePackage
      # force the install
      $ python -m pip install --user --ignore-installed SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:> py -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      C:> py -m pip install --user --upgrade SomePackage
      [...]
      Requirement already up-to-date: SomePackage
      # force the install
      C:> py -m pip install --user --ignore-installed SomePackage
      [...]
      Successfully installed SomePackage

Ensuring Repeatability

This is now covered in :doc:`../topics/repeatable-installs`.

Fixing conflicting dependencies

This is now covered in :doc:`../topics/dependency-resolution`.

Using pip from your program

As noted previously, pip is a command line program. While it is implemented in
Python, and so is available from your Python code via import pip, you must
not use pip’s internal APIs in this way. There are a number of reasons for this:

  1. The pip code assumes that it is in sole control of the global state of the
    program.
    pip manages things like the logging system configuration, or the values of
    the standard IO streams, without considering the possibility that user code
    might be affected.
  2. pip’s code is not thread safe. If you were to run pip in a thread, there
    is no guarantee that either your code or pip’s would work as you expect.
  3. pip assumes that once it has finished its work, the process will terminate.
    It doesn’t need to handle the possibility that other code will continue to
    run after that point, so (for example) calling pip twice in the same process
    is likely to have issues.

This does not mean that the pip developers are opposed in principle to the idea
that pip could be used as a library — it’s just that this isn’t how it was
written, and it would be a lot of work to redesign the internals for use as a
library, handling all of the above issues, and designing a usable, robust and
stable API that we could guarantee would remain available across multiple
releases of pip. And we simply don’t currently have the resources to even
consider such a task.

What this means in practice is that everything inside of pip is considered an
implementation detail. Even the fact that the import name is pip is subject
to change without notice. While we do try not to break things as much as
possible, all the internal APIs can change at any time, for any reason. It also
means that we generally won’t fix issues that are a result of using pip in an
unsupported way.

It should also be noted that installing packages into sys.path in a running
Python process is something that should only be done with care. The import
system caches certain data, and installing new packages while a program is
running may not always behave as expected. In practice, there is rarely an
issue, but it is something to be aware of.

Having said all of the above, it is worth covering the options available if you
decide that you do want to run pip from within your program. The most reliable
approach, and the one that is fully supported, is to run pip in a subprocess.
This is easily done using the standard subprocess module:

subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'my_package'])

If you want to process the output further, use one of the other APIs in the module.
We are using freeze here which outputs installed packages in requirements format.:

reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])

If you don’t want to use pip’s command line functionality, but are rather
trying to implement code that works with Python packages, their metadata, or
PyPI, then you should consider other, supported, packages that offer this type
of ability. Some examples that you could consider include:

  • packaging — Utilities to work with standard package metadata (versions,
    requirements, etc.)
  • setuptools (specifically pkg_resources) — Functions for querying what
    packages the user has installed on their system.
  • distlib — Packaging and distribution utilities (including functions for
    interacting with PyPI).

Changes to the pip dependency resolver in 20.3 (2020)

pip 20.3 has a new dependency resolver, on by default for Python 3
users. (pip 20.1 and 20.2 included pre-release versions of the new
dependency resolver, hidden behind optional user flags.) Read below
for a migration guide, how to invoke the legacy resolver, and the
deprecation timeline. We also made a two-minute video explanation
you can watch.

We will continue to improve the pip dependency resolver in response to
testers’ feedback. Please give us feedback through the resolver
testing survey.

Watch out for

The big change in this release is to the pip dependency resolver
within pip.

Computers need to know the right order to install pieces of software
(«to install x, you need to install y first»). So, when Python
programmers share software as packages, they have to precisely describe
those installation prerequisites, and pip needs to navigate tricky
situations where it’s getting conflicting instructions. This new
dependency resolver will make pip better at handling that tricky
logic, and make pip easier for you to use and troubleshoot.

The most significant changes to the resolver are:

  • It will reduce inconsistency: it will no longer install a
    combination of packages that is mutually inconsistent
    . In older
    versions of pip, it is possible for pip to install a package which
    does not satisfy the declared requirements of another installed
    package. For example, in pip 20.0, pip install "six<1.12"
    "virtualenv==20.0.2"
    does the wrong thing, “successfully” installing
    six==1.11, even though virtualenv==20.0.2 requires
    six>=1.12.0,<2 (defined here).
    The new resolver, instead, outright rejects installing anything if it
    gets that input.
  • It will be stricter — if you ask pip to install two packages with
    incompatible requirements, it will refuse (rather than installing a
    broken combination, like it did in previous versions).

So, if you have been using workarounds to force pip to deal with
incompatible or inconsistent requirements combinations, now’s a good
time to fix the underlying problem in the packages, because pip will
be stricter from here on out.

This also means that, when you run a pip install command, pip only
considers the packages you are installing in that command, and may
break already-installed packages
. It will not guarantee that your
environment will be consistent all the time. If you pip install x
and then pip install y, it’s possible that the version of y
you get will be different than it would be if you had run pip
install x y
in a single command. We are considering changing this
behavior (per :issue:`7744`) and would like your thoughts on what
pip’s behavior should be; please answer our survey on upgrades that
create conflicts.

We are also changing our support for :ref:`Constraints Files`,
editable installs, and related functionality. We did a fairly
comprehensive overhaul and stripped constraints files down to being
purely a way to specify global (version) limits for packages, and so
some combinations that used to be allowed will now cause
errors. Specifically:

  • Constraints don’t override the existing requirements; they simply
    constrain what versions are visible as input to the resolver (see
    :issue:`9020`)
  • Providing an editable requirement (-e .) does not cause pip to
    ignore version specifiers or constraints (see :issue:`8076`), and if
    you have a conflict between a pinned requirement and a local
    directory then pip will indicate that it cannot find a version
    satisfying both (see :issue:`8307`)
  • Hash-checking mode requires that all requirements are specified as a
    == match on a version and may not work well in combination with
    constraints (see :issue:`9020` and :issue:`8792`)
  • If necessary to satisfy constraints, pip will happily reinstall
    packages, upgrading or downgrading, without needing any additional
    command-line options (see :issue:`8115` and :doc:`development/architecture/upgrade-options`)
  • Unnamed requirements are not allowed as constraints (see :issue:`6628` and :issue:`8210`)
  • Links are not allowed as constraints (see :issue:`8253`)
  • Constraints cannot have extras (see :issue:`6628`)

Per our :ref:`Python 2 Support` policy, pip 20.3 users who are using
Python 2 will use the legacy resolver by default. Python 2 users
should upgrade to Python 3 as soon as possible, since in pip 21.0 in
January 2021, pip dropped support for Python 2 altogether.

How to upgrade and migrate

  1. Install pip 20.3 with python -m pip install --upgrade pip.

  2. Validate your current environment by running pip check. This
    will report if you have any inconsistencies in your set of installed
    packages. Having a clean installation will make it much less likely
    that you will hit issues with the new resolver (and may
    address hidden problems in your current environment!). If you run
    pip check and run into stuff you can’t figure out, please ask
    for help in our issue tracker or chat.

  3. Test the new version of pip.

    While we have tried to make sure that pip’s test suite covers as
    many cases as we can, we are very aware that there are people using
    pip with many different workflows and build processes, and we will
    not be able to cover all of those without your help.

    • If you use pip to install your software, try out the new resolver
      and let us know if it works for you with pip install. Try:

      • installing several packages simultaneously
      • re-creating an environment using a requirements.txt file
      • using pip install --force-reinstall to check whether
        it does what you think it should
      • using constraints files
      • the «Setups to test with special attention» and «Examples to try» below
    • If you have a build pipeline that depends on pip installing your
      dependencies for you, check that the new resolver does what you
      need.
    • Run your project’s CI (test suite, build process, etc.) using the
      new resolver, and let us know of any issues.
    • If you have encountered resolver issues with pip in the past,
      check whether the new resolver fixes them, and read :ref:`Fixing
      conflicting dependencies`
      . Also, let us know if the new resolver
      has issues with any workarounds you put in to address the
      current resolver’s limitations. We’ll need to ensure that people
      can transition off such workarounds smoothly.
    • If you develop or support a tool that wraps pip or uses it to
      deliver part of your functionality, please test your integration
      with pip 20.3.
  4. Troubleshoot and try these workarounds if necessary.

    • If pip is taking longer to install packages, read :doc:`Dependency
      resolution backtracking <topics/dependency-resolution>`
      for ways to
      reduce the time pip spends backtracking due to dependency conflicts.
    • If you don’t want pip to actually resolve dependencies, use the
      --no-deps option. This is useful when you have a set of package
      versions that work together in reality, even though their metadata says
      that they conflict. For guidance on a long-term fix, read
      :ref:`Fixing conflicting dependencies`.
    • If you run into resolution errors and need a workaround while you’re
      fixing their root causes, you can choose the old resolver behavior using
      the flag --use-deprecated=legacy-resolver. This will work until we
      release pip 21.0 (see
      :ref:`Deprecation timeline for 2020 resolver changes`).
  5. Please report bugs through the resolver testing survey.

Setups to test with special attention

  • Requirements files with 100+ packages
  • Installation workflows that involve multiple requirements files
  • Requirements files that include hashes (:ref:`hash-checking mode`)
    or pinned dependencies (perhaps as output from pip-compile within
    pip-tools)
  • Using :ref:`Constraints Files`
  • Continuous integration/continuous deployment setups
  • Installing from any kind of version control systems (i.e., Git, Subversion, Mercurial, or CVS), per :doc:`topics/vcs-support`
  • Installing from source code held in local directories

Examples to try

Install:

  • tensorflow
  • hacking
  • pycodestyle
  • pandas
  • tablib
  • elasticsearch and requests together
  • six and cherrypy together
  • pip install flake8-import-order==0.17.1 flake8==3.5.0 --use-feature=2020-resolver
  • pip install tornado==5.0 sprockets.http==1.5.0 --use-feature=2020-resolver

Try:

  • pip install
  • pip uninstall
  • pip check
  • pip cache

Tell us about

Specific things we’d love to get feedback on:

  • Cases where the new resolver produces the wrong result,
    obviously. We hope there won’t be too many of these, but we’d like
    to trap such bugs before we remove the legacy resolver.
  • Cases where the resolver produced an error when you believe it
    should have been able to work out what to do.
  • Cases where the resolver gives an error because there’s a problem
    with your requirements, but you need better information to work out
    what’s wrong.
  • If you have workarounds to address issues with the current resolver,
    does the new resolver let you remove those workarounds? Tell us!

Please let us know through the resolver testing survey.

Deprecation timeline

We plan for the resolver changeover to proceed as follows, using
:ref:`Feature Flags` and following our :ref:`Release Cadence`:

  • pip 20.1: an alpha version of the new resolver was available,
    opt-in, using the optional flag
    --unstable-feature=resolver. pip defaulted to legacy
    behavior.
  • pip 20.2: a beta of the new resolver was available, opt-in, using
    the flag --use-feature=2020-resolver. pip defaulted to legacy
    behavior. Users of pip 20.2 who want pip to default to using the
    new resolver can run pip config set global.use-feature
    2020-resolver
    (for more on that and the alternate
    PIP_USE_FEATURE environment variable option, see issue
    8661).
  • pip 20.3: pip defaults to the new resolver in Python 3 environments,
    but a user can opt-out and choose the old resolver behavior,
    using the flag --use-deprecated=legacy-resolver. In Python 2
    environments, pip defaults to the old resolver, and the new one is
    available using the flag --use-feature=2020-resolver.
  • pip 21.0: pip uses new resolver by default, and the old resolver is
    no longer supported. It will be removed after a currently undecided
    amount of time, as the removal is dependent on pip’s volunteer
    maintainers’ availability. Python 2 support is removed per our
    :ref:`Python 2 Support` policy.

Since this work will not change user-visible behavior described in the
pip documentation, this change is not covered by the :ref:`Deprecation
Policy`
.

Context and followup

As discussed in our announcement on the PSF blog, the pip team are
in the process of developing a new «dependency resolver» (the part of
pip that works out what to install based on your requirements).

We’re tracking our rollout in :issue:`6536` and you can watch for
announcements on the low-traffic packaging announcements list and
the official Python blog.

Using system trust stores for verifying HTTPS

This is now covered in :doc:`topics/https-certificates`.

pip — система управления пакетами, которая используется для установки и управления программными пакетами, написанными на Python. Много пакетов можно найти в Python Package Index.

Начиная с Python версии 3.4, pip поставляется вместе с интерпретатором языка Python. Если pip отсутствует, то его можно установить двумя способами:

  • при помощи модуля ensurepip , который обеспечивает поддержку начальной загрузки pip в виртуальную среду или существующую установку Python
  • при помощи скрипта установки get-pip.py , который можно скачать при помощи утилиты bash wget с сайта https://bootstrap.pypa.io/:

Не забудьте обновить pip после установки:

Если вы не можете запустить pip команду напрямую (возможно, из-за отсутствия пути до директории с Python в системной переменной PATH ), вы можете запустить pip через интерпретатор Python:

Установка пакетов

pip поддерживает установку пакетов из Python Package Index, локальных репозиториев и напрямую из дистрибутивных файлов.

pip предоставляет возможность управлять всеми зависимостями вашего проекта с помощью файла requirements.txt — файл зависимостей проекта, содержащий список пакетов и модулей, которые нужно установить для нормальной работы.

Это позволяет эффективно воспроизводить весь необходимый список пакетов в отдельном окружении (например, на другом компьютере) или в виртуальном окружении. requirements.txt содержит список аргументов установки pip , помещенных в файл с целью обеспечения повторяющихся установок. Закрепление версий зависимостей пакетов в файле requirements.txt защищает вас от ошибок или несовместимостей в недавно выпущенных версиях пакетов.

Составим список закрепленных версий всех пакетов, что были установлены в проекте с помощью команды pip freeze .

Важно понимать, что pip определяет зависимости пакетов, используя метаданные install_requires , а не путем обнаружения requirements.txt файлов, встроенных в проекты.

Удаление пакетов

pip может удалить большинство пакетов следующим образом:

pip также выполняет автоматическое удаление старой версии пакета перед обновлением до новой версии.

Просмотр списка установленных

Чтобы вывести список устаревших пакетов и показать последнюю доступную версию:

User Guide#

pip is a command line program. When you install pip, a pip command is added to your system, which can be run from the command prompt as follows:

python -m pip executes pip using the Python interpreter you specified as python. So /usr/bin/python3.7 -m pip means you are executing pip for your interpreter located at /usr/bin/python3.7 .

py -m pip executes pip using the latest Python interpreter you have installed. For more details, read the Python Windows launcher docs.

Installing Packages#

pip supports installing from PyPI, version control, local projects, and directly from distribution files.

The most common scenario is to install from PyPI using Requirement Specifiers

For more information and examples, see the pip install reference.

Basic Authentication Credentials

This is now covered in Authentication .

This is now covered in Authentication .

This is now covered in Authentication .

Using a Proxy Server#

When installing packages from PyPI, pip requires internet access, which in many corporate environments requires an outbound HTTP proxy server.

pip can be configured to connect through a proxy server in various ways:

using the —proxy command-line option to specify a proxy in the form scheme://[user:passwd@]proxy.server:port

by setting the standard environment-variables http_proxy , https_proxy and no_proxy .

using the environment variable PIP_USER_AGENT_USER_DATA to include a JSON-encoded string in the user-agent variable used in pip’s requests.

Requirements Files#

“Requirements files” are files containing a list of items to be installed using pip install like so:

Details on the format of the files are here: Requirements File Format .

Logically, a Requirements file is just a list of pip install arguments placed in a file. Note that you should not rely on the items in the file being installed by pip in any particular order.

In practice, there are 4 common uses of Requirements files:

Requirements files are used to hold the result from pip freeze for the purpose of achieving Repeatable Installs . In this case, your requirement file contains a pinned version of everything that was installed when pip freeze was run.

Requirements files are used to force pip to properly resolve dependencies. pip 20.2 and earlier doesn’t have true dependency resolution, but instead simply uses the first specification it finds for a project. E.g. if pkg1 requires pkg3>=1.0 and pkg2 requires pkg3>=1.0,<=2.0 , and if pkg1 is resolved first, pip will only use pkg3>=1.0 , and could easily end up installing a version of pkg3 that conflicts with the needs of pkg2 . To solve this problem, you can place pkg3>=1.0,<=2.0 (i.e. the correct specification) into your requirements file directly along with the other top level requirements. Like so:

Requirements files are used to force pip to install an alternate version of a sub-dependency. For example, suppose ProjectA in your requirements file requires ProjectB , but the latest version (v1.3) has a bug, you can force pip to accept earlier versions like so:

Requirements files are used to override a dependency with a local patch that lives in version control. For example, suppose a dependency SomeDependency from PyPI has a bug, and you can’t wait for an upstream fix. You could clone/copy the src, make the fix, and place it in VCS with the tag sometag . You’d reference it in your requirements file with a line like so:

If SomeDependency was previously a top-level requirement in your requirements file, then replace that line with the new line. If SomeDependency is a sub-dependency, then add the new line.

It’s important to be clear that pip determines package dependencies using install_requires metadata, not by discovering requirements.txt files embedded in projects.

Constraints Files#

Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not. Their syntax and contents is a subset of Requirements Files , with several kinds of syntax not allowed: constraints must have a name, they cannot be editable, and they cannot specify extras. In terms of semantics, there is one key difference: Including a package in a constraints file does not trigger installation of the package.

Use a constraints file like so:

Constraints files are used for exactly the same reason as requirements files when you don’t know exactly what things you want to install. For instance, say that the “helloworld” package doesn’t work in your environment, so you have a local patched version. Some things you install depend on “helloworld”, and some don’t.

One way to ensure that the patched version is used consistently is to manually audit the dependencies of everything you install, and if “helloworld” is present, write a requirements file to use when installing that thing.

Constraints files offer a better way: write a single constraints file for your organisation and use that everywhere. If the thing being installed requires “helloworld” to be installed, your fixed version specified in your constraints file will be used.

Constraints file support was added in pip 7.1. In Changes to the pip dependency resolver in 20.3 (2020) we did a fairly comprehensive overhaul, removing several undocumented and unsupported quirks from the previous implementation, and stripped constraints files down to being purely a way to specify global (version) limits for packages.

Installing from Wheels#

“Wheel” is a built, archive format that can greatly speed installation compared to building and installing from source archives. For more information, see the Wheel docs , PEP 427, and PEP 425.

pip prefers Wheels where they are available. To disable this, use the —no-binary flag for pip install .

If no satisfactory wheels are found, pip will default to finding source archives.

To install directly from a wheel archive:

To include optional dependencies provided in the provides_extras metadata in the wheel, you must add quotes around the install target name:

In the future, the path[extras] syntax may become deprecated. It is recommended to use PEP 508 syntax wherever possible.

For the cases where wheels are not available, pip offers pip wheel as a convenience, to build wheels for all your requirements and dependencies.

pip wheel requires the wheel package to be installed, which provides the “bdist_wheel” setuptools extension that it uses.

To build wheels for your requirements and all their dependencies to a local directory:

And then to install those requirements just using your local directory of wheels (and not from PyPI):

Uninstalling Packages#

pip is able to uninstall most packages like so:

pip also performs an automatic uninstall of an old version of a package before upgrading to a newer version.

For more information and examples, see the pip uninstall reference.

Listing Packages#

To list installed packages:

To list outdated packages, and show the latest version available:

To show details about an installed package:

For more information and examples, see the pip list and pip show reference pages.

Searching for Packages#

pip can search PyPI for packages using the pip search command:

The query will be used to search the names and summaries of all packages.

For more information and examples, see the pip search reference.

This is now covered in Configuration .

This is now covered in Configuration .

This is now covered in Configuration .

This is now covered in Configuration .

Command Completion#

pip comes with support for command line completion in bash, zsh and fish.

To setup for bash:

To setup for zsh:

To setup for fish:

To setup for powershell:

Alternatively, you can use the result of the completion command directly with the eval function of your shell, e.g. by adding the following to your startup file:

Installing from local packages#

In some cases, you may want to install from local packages only, with no traffic to PyPI.

First, download the archives that fulfill your requirements:

Note that pip download will look in your wheel cache first, before trying to download from PyPI. If you’ve never installed your requirements before, you won’t have a wheel cache for those items. In that case, if some of your requirements don’t come as wheels from PyPI, and you want wheels, then run this instead:

Then, to install from local only, you’ll be using —find-links and —no-index like so:

“Only if needed” Recursive Upgrade#

pip install —upgrade now has a —upgrade-strategy option which controls how pip handles upgrading of dependencies. There are 2 upgrade strategies supported:

eager : upgrades all dependencies regardless of whether they still satisfy the new parent requirements

only-if-needed : upgrades a dependency only if it does not satisfy the new parent requirements

The default strategy is only-if-needed . This was changed in pip 10.0 due to the breaking nature of eager when upgrading conflicting dependencies.

It is important to note that —upgrade affects direct requirements (e.g. those specified on the command-line or via a requirements file) while —upgrade-strategy affects indirect requirements (dependencies of direct requirements).

As an example, say SomePackage has a dependency, SomeDependency , and both of them are already installed but are not the latest available versions:

pip install SomePackage : will not upgrade the existing SomePackage or SomeDependency .

pip install —upgrade SomePackage : will upgrade SomePackage , but not SomeDependency (unless a minimum requirement is not met).

pip install —upgrade SomePackage —upgrade-strategy=eager : upgrades both SomePackage and SomeDependency .

As an historic note, an earlier “fix” for getting the only-if-needed behaviour was:

A proposal for an upgrade-all command is being considered as a safer alternative to the behaviour of eager upgrading.

User Installs#

With Python 2.6 came the “user scheme” for installation, which means that all Python distributions support an alternative install location that is specific to a user. The default location for each OS is explained in the python documentation for the site.USER_BASE variable. This mode of installation can be turned on by specifying the —user option to pip install .

Moreover, the “user scheme” can be customized by setting the PYTHONUSERBASE environment variable, which updates the value of site.USER_BASE .

To install “SomePackage” into an environment with site.USER_BASE customized to ‘/myappenv’, do the following:

pip install —user follows four rules:

When globally installed packages are on the python path, and they conflict with the installation requirements, they are ignored, and not uninstalled.

When globally installed packages are on the python path, and they satisfy the installation requirements, pip does nothing, and reports that requirement is satisfied (similar to how global packages can satisfy requirements when installing packages in a —system-site-packages virtualenv).

pip will not perform a —user install in a —no-site-packages virtualenv (i.e. the default kind of virtualenv), due to the user site not being on the python path. The installation would be pointless.

In a —system-site-packages virtualenv, pip will not install a package that conflicts with a package in the virtualenv site-packages. The —user installation would lack sys.path precedence and be pointless.

To make the rules clearer, here are some examples:

From within a —no-site-packages virtualenv (i.e. the default kind):

From within a —system-site-packages virtualenv where SomePackage==0.3 is already installed in the virtualenv:

From within a real python, where SomePackage is not installed globally:

From within a real python, where SomePackage is installed globally, but is not the latest version:

From within a real python, where SomePackage is installed globally, and is the latest version:

This is now covered in Repeatable Installs .

Fixing conflicting dependencies

Using pip from your program#

As noted previously, pip is a command line program. While it is implemented in Python, and so is available from your Python code via import pip , you must not use pip’s internal APIs in this way. There are a number of reasons for this:

The pip code assumes that is in sole control of the global state of the program. pip manages things like the logging system configuration, or the values of the standard IO streams, without considering the possibility that user code might be affected.

pip’s code is not thread safe. If you were to run pip in a thread, there is no guarantee that either your code or pip’s would work as you expect.

pip assumes that once it has finished its work, the process will terminate. It doesn’t need to handle the possibility that other code will continue to run after that point, so (for example) calling pip twice in the same process is likely to have issues.

This does not mean that the pip developers are opposed in principle to the idea that pip could be used as a library — it’s just that this isn’t how it was written, and it would be a lot of work to redesign the internals for use as a library, handling all of the above issues, and designing a usable, robust and stable API that we could guarantee would remain available across multiple releases of pip. And we simply don’t currently have the resources to even consider such a task.

What this means in practice is that everything inside of pip is considered an implementation detail. Even the fact that the import name is pip is subject to change without notice. While we do try not to break things as much as possible, all the internal APIs can change at any time, for any reason. It also means that we generally won’t fix issues that are a result of using pip in an unsupported way.

It should also be noted that installing packages into sys.path in a running Python process is something that should only be done with care. The import system caches certain data, and installing new packages while a program is running may not always behave as expected. In practice, there is rarely an issue, but it is something to be aware of.

Having said all of the above, it is worth covering the options available if you decide that you do want to run pip from within your program. The most reliable approach, and the one that is fully supported, is to run pip in a subprocess. This is easily done using the standard subprocess module:

If you want to process the output further, use one of the other APIs in the module. We are using freeze here which outputs installed packages in requirements format.:

If you don’t want to use pip’s command line functionality, but are rather trying to implement code that works with Python packages, their metadata, or PyPI, then you should consider other, supported, packages that offer this type of ability. Some examples that you could consider include:

packaging — Utilities to work with standard package metadata (versions, requirements, etc.)

setuptools (specifically pkg_resources ) — Functions for querying what packages the user has installed on their system.

distlib — Packaging and distribution utilities (including functions for interacting with PyPI).

Changes to the pip dependency resolver in 20.3 (2020)#

pip 20.3 has a new dependency resolver, on by default for Python 3 users. (pip 20.1 and 20.2 included pre-release versions of the new dependency resolver, hidden behind optional user flags.) Read below for a migration guide, how to invoke the legacy resolver, and the deprecation timeline. We also made a two-minute video explanation you can watch.

We will continue to improve the pip dependency resolver in response to testers’ feedback. Please give us feedback through the resolver testing survey.

Watch out for#

The big change in this release is to the pip dependency resolver within pip.

Computers need to know the right order to install pieces of software (“to install x , you need to install y first”). So, when Python programmers share software as packages, they have to precisely describe those installation prerequisites, and pip needs to navigate tricky situations where it’s getting conflicting instructions. This new dependency resolver will make pip better at handling that tricky logic, and make pip easier for you to use and troubleshoot.

The most significant changes to the resolver are:

It will reduce inconsistency: it will no longer install a combination of packages that is mutually inconsistent. In older versions of pip, it is possible for pip to install a package which does not satisfy the declared requirements of another installed package. For example, in pip 20.0, pip install «six<1.12» «virtualenv==20.0.2» does the wrong thing, “successfully” installing six==1.11 , even though virtualenv==20.0.2 requires six>=1.12.0,<2 (defined here). The new resolver, instead, outright rejects installing anything if it gets that input.

It will be stricter — if you ask pip to install two packages with incompatible requirements, it will refuse (rather than installing a broken combination, like it did in previous versions).

So, if you have been using workarounds to force pip to deal with incompatible or inconsistent requirements combinations, now’s a good time to fix the underlying problem in the packages, because pip will be stricter from here on out.

This also means that, when you run a pip install command, pip only considers the packages you are installing in that command, and may break already-installed packages. It will not guarantee that your environment will be consistent all the time. If you pip install x and then pip install y , it’s possible that the version of y you get will be different than it would be if you had run pip install x y in a single command. We are considering changing this behavior (per #7744) and would like your thoughts on what pip’s behavior should be; please answer our survey on upgrades that create conflicts.

We are also changing our support for Constraints Files , editable installs, and related functionality. We did a fairly comprehensive overhaul and stripped constraints files down to being purely a way to specify global (version) limits for packages, and so some combinations that used to be allowed will now cause errors. Specifically:

Constraints don’t override the existing requirements; they simply constrain what versions are visible as input to the resolver (see #9020)

Providing an editable requirement ( -e . ) does not cause pip to ignore version specifiers or constraints (see #8076), and if you have a conflict between a pinned requirement and a local directory then pip will indicate that it cannot find a version satisfying both (see #8307)

Hash-checking mode requires that all requirements are specified as a == match on a version and may not work well in combination with constraints (see #9020 and #8792)

If necessary to satisfy constraints, pip will happily reinstall packages, upgrading or downgrading, without needing any additional command-line options (see #8115 and Options that control the installation process )

Unnamed requirements are not allowed as constraints (see #6628 and #8210)

Links are not allowed as constraints (see #8253)

Constraints cannot have extras (see #6628)

Per our Python 2 Support policy, pip 20.3 users who are using Python 2 will use the legacy resolver by default. Python 2 users should upgrade to Python 3 as soon as possible, since in pip 21.0 in January 2021, pip dropped support for Python 2 altogether.

How to upgrade and migrate#

Install pip 20.3 with python -m pip install —upgrade pip .

Validate your current environment by running pip check . This will report if you have any inconsistencies in your set of installed packages. Having a clean installation will make it much less likely that you will hit issues with the new resolver (and may address hidden problems in your current environment!). If you run pip check and run into stuff you can’t figure out, please ask for help in our issue tracker or chat.

Test the new version of pip.

While we have tried to make sure that pip’s test suite covers as many cases as we can, we are very aware that there are people using pip with many different workflows and build processes, and we will not be able to cover all of those without your help.

If you use pip to install your software, try out the new resolver and let us know if it works for you with pip install . Try:

installing several packages simultaneously

re-creating an environment using a requirements.txt file

using pip install —force-reinstall to check whether it does what you think it should

using constraints files

the “Setups to test with special attention” and “Examples to try” below

If you have a build pipeline that depends on pip installing your dependencies for you, check that the new resolver does what you need.

Run your project’s CI (test suite, build process, etc.) using the new resolver, and let us know of any issues.

If you have encountered resolver issues with pip in the past, check whether the new resolver fixes them, and read Dealing with dependency conflicts . Also, let us know if the new resolver has issues with any workarounds you put in to address the current resolver’s limitations. We’ll need to ensure that people can transition off such workarounds smoothly.

If you develop or support a tool that wraps pip or uses it to deliver part of your functionality, please test your integration with pip 20.3.

Troubleshoot and try these workarounds if necessary.

If pip is taking longer to install packages, read Dependency resolution backtracking for ways to reduce the time pip spends backtracking due to dependency conflicts.

If you don’t want pip to actually resolve dependencies, use the —no-deps option. This is useful when you have a set of package versions that work together in reality, even though their metadata says that they conflict. For guidance on a long-term fix, read Dealing with dependency conflicts .

If you run into resolution errors and need a workaround while you’re fixing their root causes, you can choose the old resolver behavior using the flag —use-deprecated=legacy-resolver . This will work until we release pip 21.0 (see Deprecation timeline ).

Please report bugs through the resolver testing survey.

Setups to test with special attention#

Requirements files with 100+ packages

Installation workflows that involve multiple requirements files

Requirements files that include hashes ( Hash-checking Mode ) or pinned dependencies (perhaps as output from pip-compile within pip-tools )

pip Uninstall / удаление пакета, установленного с помощью pip

FavoriteДобавить в избранное

Главное меню » Операционная система Linux » pip Uninstall / удаление пакета, установленного с помощью pip

Как управлять пакетами Python с использованием Pip

Если вы следовали одним из наших предыдущих руководств о том, как установить и использовать pip на Ubuntu 16.04 или как установить и использовать pip на CentOS 7 и вы установили некоторые пакеты Python, которые вы не хотите использовать, вы можете легко удалить их с помощью pip.

Прежде всего, подключитесь к серверу Linux с помощью SSH. Затем узнайте список установленных на текущий момент пакетов, используя следующую команду:

Команда выше даст вам выход аналогичный приведенному ниже:

Все эти пакеты уже установлены через pip, и вы можете удалить любой пакет, который вам не нужен. Чтобы удалить установленный пакет с помощью команды pip install , вы можете использовать pip uninstall . Например, чтобы удалить пакет beautifulsoup4 , вы можете использовать следующую команду:

После выполнения команды, pip попросит вас подтвердить действие. Введите y чтобы подтвердить и пакет будет удален из системы.

Как вы можете видеть, удалить пакеты с pip так просто, как установить их. Изучение того, как вы можете управлять пакетами, установленные на вашем Ubuntu VPS или CentOS VPS с pipом поможет вам создавать лучшие приложения. pip также полезен для многих других задач, как обновление пакетов, которые установлены в настоящее время, или установить конкретную версию пакета для проекта. Для полного списка опций, которые вы можете использовать с pip, вы можете узнать через команду pip —help

Для получения более подробной информации о том, как использовать pip uninstall, вы можете обратиться к документации pip (https://pip.pypa.io/en/stable/) для pip uninstall и другие примеры использования.

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

В процессе разработки программного обеспечения на Python часто возникает необходимость воспользоваться пакетом, который в данный момент отсутствует на вашем компьютере. О том, откуда взять нужный вам пакет и как его установить, вы узнаете из этого урока.

  • Где взять отсутствующий пакет?
  • Менеджер пакетов в Python pip
  • Установка pip
  • Обновление pip
  • Использование pip
    • Установка пакета
    • Удаление пакета
    • Обновление пакетов
    • Просмотр установленных пакетов
    • Поиск пакета в репозитории
  • Где еще можно почитать про работу с pip?

Где взять отсутствующий пакет?

Необходимость в установке дополнительного пакета возникнет очень быстро, если вы решите поработать над задачей, за рамками базового функционала, который предоставляет Python. Например: работа с web, обработка изображений, криптография и т.п. В этом случае, необходимо узнать, какой пакет содержит функционал, который вам необходим, найти его, скачать, разместить в нужном каталоге и начать использовать. Все эти действия можно сделать вручную, но этот процесс поддается автоматизации. К тому же скачивать пакеты с неизвестных сайтов может быть довольно опасно.

К счастью для нас, в рамках Python, все эти задачи решены. Существует так называемый Python Package Index (PyPI) – это репозиторий, открытый для всех Python разработчиков, в нем вы можете найти пакеты для решения практически любых задач. Там также есть возможность выкладывать свои пакеты. Для скачивания и установки используется специальная утилита, которая называется pip.

Менеджер пакетов в Python pip

Pip – это консольная утилита (без графического интерфейса). После того, как вы ее скачаете и установите, она пропишется в PATH и будет доступна для использования.

Эту утилиту можно запускать как самостоятельно:

> pip <аргументы>

так и через интерпретатор Python:

> python -m pip <аргументы>

Ключ -m означает, что мы хотим запустить модуль (в данном случае pip). Более подробно о том, как использовать pip, вы сможете прочитать ниже.

Установка pip

При развертывании современной версии Python (начиная с Python 2.7.9 и Python 3.4),
pip устанавливается автоматически. Но если, по какой-то причине, pip не установлен на вашем ПК, то сделать это можно вручную. Существует несколько способов.

Универсальный способ

Будем считать, что Python у вас уже установлен, теперь необходимо установить pip. Для того, чтобы это сделать, скачайте скрипт get-pip.py

> curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

и выполните его.

> python get-pip.py

При этом, вместе с pip будут установлены setuptools и wheels. Setuptools  – это набор инструментов для построения пакетов Python. Wheels – это формат дистрибутива для пакета Python. Обсуждение этих составляющих выходит за рамки урока, поэтому мы не будем на них останавливаться.

Способ для Linux

Если вы используете Linux, то для установки pip можно воспользоваться имеющимся в вашем дистрибутиве пакетным менеджером. Ниже будут перечислены команды для ряда Linux систем, запускающие установку pip (будем рассматривать только Python 3, т.к. Python 2 уже морально устарел, а его поддержка и развитие будут прекращены после 2020 года).

Fedora

Fedora 21:

> sudo yum install python3 python3-wheel

Fedora 22:

> sudo dnf install python3 python3-wheel

openSUSE

> sudo zypper install python3-pip python3-setuptools python3-wheel

Debian/Ubuntu

> sudo apt install python3-venv python3-pip

Arch Linux

> sudo pacman -S python-pip

Обновление pip

Если вы работаете с Linux, то для обновления pip запустите следующую команду.

> pip install -U pip

Для Windows команда будет следующей:

> python -m pip install -U pip

Использование pip

Далее рассмотрим основные варианты использования pip: установка пакетов, удаление и обновление пакетов.

Установка пакета

Pip позволяет установить самую последнюю версию пакета, конкретную версию или воспользоваться логическим выражением, через которое можно определить, что вам, например, нужна версия не ниже указанной. Также есть поддержка установки пакетов из репозитория. Рассмотрим, как использовать эти варианты.

Установка последней версии пакета

> pip install ProjectName

Установка определенной версии

> pip install ProjectName==3.2

Установка пакета с версией не ниже 3.1

> pip install ProjectName>=3.1

Установка Python пакета из git репозитория

> pip install -e git+https://gitrepo.com/ProjectName.git

Установка из альтернативного индекса

> pip install --index-url http://pypackage.com/ ProjectName

Установка пакета из локальной директории

> pip install ./dist/ProjectName.tar.gz

Удаление пакета

Для того, чтобы удалить пакет воспользуйтесь командой

> pip uninstall ProjectName

Обновление пакетов

Для обновления пакета используйте ключ –upgrade.

> pip install --upgrade ProjectName

Просмотр установленных пакетов

Для вывода списка всех установленных пакетов применяется команда pip list.

> pip list

Если вы хотите получить более подробную информацию о конкретном пакете, то используйте аргумент show.

> pip show ProjectName

Поиск пакета в репозитории

Если вы не знаете точное название пакета, или хотите посмотреть на пакеты, содержащие конкретное слово, то вы можете это сделать, используя аргумент search.

> pip search "test"

Где ещё можно прочитать про работу с pip?

В сети довольно много информации по работе с данной утилитой.

Python Packaging User Guide – набор различных руководств по работе с пакетами в Python

Документация по pip.

Статья на Geekbrains.

P.S.

Если вам интересна тема анализа данных, то мы рекомендуем ознакомиться с библиотекой Pandas. На нашем сайте вы можете найти вводные уроки по этой теме. Все уроки по библиотеке Pandas собраны в книге “Pandas. Работа с данными”.
Книга: Pandas. Работа с данными

<<< Python. Урок 15. Итераторы и генераторы    Python. Урок 17. Виртуальные окружения>>>

Понравилась статья? Поделить с друзьями:
  • Как удалить библиотеки в проводнике windows 10
  • Как удалить беспроводное сетевое соединение в windows 10
  • Как удалить бесплатного касперского с компьютера полностью windows 7
  • Как удалить белорусский язык в windows 10
  • Как удалить безопасность windows 10 навсегда