Ошибка warning you are using pip version

C:Usersuseri>python -m pip install —upgrade pip
Requirement already satisfied: pip in c:python39libsite-packages (21.1.3)
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 1.3 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.3
Uninstalling pip-21.1.3:
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: ‘c:\python39\lib\site-packages\pip-21.1.3.dist-info\entry_points.txt’
Consider using the `—user` option or check the permissions.

WARNING: You are using pip version 21.1.3; however, version 21.3 is available.
You should consider upgrading via the ‘C:Python39python.exe -m pip install —upgrade pip’ command.

Судя по ошибке ‘gcc’, либо у вас не установлены нужные библиотеки (sys, setuptools, tokenize), либо они не прописаны в пути, которым пользуется ‘gcc’, Это переменная с именем $LIBPATH или что-то вроде этого.

– user244413

3 мар 2020 в 19:03

@marcelm

What’s the problem this feature will solve?

Whenever there is a new pip release, I get a message like this the next time I run pip install in one of my virtualenvs:

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

Because I have never suffered any negative consequences from upgrading (thank you for that) and also because I don’t want to see the message again, I nearly always run the upgrade immediately. However, it does not feel very productive to do this manually.

Describe the solution you’d like

Instead of telling me how to upgrade pip, pip could just do the upgrade.

Here is some brainstorming how this could work. Instead of --disable-pip-version-check, there could be a new option, something like --pip-version-upgraded-action=, with different actions:

  • disable would be the same as --disable-pip-version-check
  • notice prints the notice (current behavior)
  • ask prompts interactively whether to do an upgrade
  • upgrade does the upgrade without prompting

Maybe this is going too far, but I could even imagine that ask could become the default 1) if the prompt is only shown when input is a terminal and 2) if the options are not only «yes» and «no», but also «no, and don’t ask again for this virtual environment».

Alternative Solutions

Perhaps an argument could be made that no upgrade notice should be shown by default. They are not shown for other packages in the virtual environment, so why single out pip?

I am aware of --disable-pip-version-check, but as long as consensus is that pip is important enough to be upgraded as soon as a new release comes out (hence notices are shown), I would prefer to do the upgrade.

Code of Conduct

  • I agree to follow the PSF Code of Conduct.

@notatallshaw

upgrade does the upgrade without prompting

What sub-commands would this trigger on?

Would it happen before the sub-command and then the sub-command is run?

If the user was using the install sub-command would the options the user provided to the install sub-command be passed to the pip upgrade? Such as what index is being used? Or if a --user flag is passed?

@marcelm

What sub-commands would this trigger on?

Since a decision has already been made when to show notices, I’d just go with that. That is, whichever command currently triggers a notice would trigger an update instead (these seem to be install, download, list, index, and wheel). But in at least my case, just install would be good enough.

Would it happen before the sub-command and then the sub-command is run?

I guess that it does not really matter in practice, but it would feel cleaner to do the upgrade first, at least in the case of the install subcommand.

If the user was using the install sub-command would the options the user provided to the install sub-command be passed to the pip upgrade? Such as what index is being used?

When I use install with --index-url, the upgrade notice doesn’t include --index-url. I don’t know how much sense this makes, but my point is that the notice already shows the recommended command. If the command isn’t correct, then it’s a problem already now.

Or if a --user flag is passed?

Are upgrade notices even triggered with --user? I don’t know whether it’s due to Debian/Ubuntu-specific patches, but
using my system pip on Ubuntu, there’s no notice with --user.

@uranusjr

I would only trigger this on install, and maybe uninstall. Having other seemingly read-only commands silently modifying the environment feels very wrong.

@notatallshaw

install with --index-url, the upgrade notice doesn’t include --index-url. I don’t know how much sense this makes, but my point is that the notice already shows the recommended command. If the command isn’t correct, then it’s a problem already now.

The command it gives is a best suggestion on how to upgrade, for example on Windows pip can not guarantee the quoting of the executable so it doesn’t attempt to quote it and in many situations copying and pasting it will fail.

I used to work in a large company where people regularly passed in --index-url to get Pip to point a private proxy of Pypi, if the command did not pass in --index-url it would fail to download anything. So what should pip do with the rest of the install if the upgrade pip step fails?

Are upgrade notices even triggered with —user? I don’t know whether it’s due to Debian/Ubuntu-specific patches, but using my system pip on Ubuntu, there’s no notice with —user.

Seems to give the notice for me:

$ python3 -m pip install attrs --user
Requirement already satisfied: attrs in /usr/lib/python3/dist-packages (21.2.0)
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

btw I don’t have any strong opinions on how this should be implemented, just immediate clarifying questions that come to mind.

@cchadha2

In terms of the upgrade option, would you print the notice and then execute the command? At the very least this would provide some context in logs.

Having said that, I’m generally not a fan of implicitly upgrading a tool as the user executes commands. Constraining this to install and uninstall might make sense but introduces inconsistency between when the notice is printed and when the implicit upgrade is performed.

I wonder if it’d be useful to check how npm handles this…AFAIK the upgrade step is always explicit?

@pfmoore

If a Windows user installs a package xxx using pip install xxx, then the pip.exe wrapper is in use, and cannot be upgraded. What would the automatic upgrade do in that case?

Having said this, I’m basically -1 on the idea. I’m not aware of any other program that upgrades itself without the user invoking a dedicated “self upgrade” command, and I think that doing so would be a source of difficult to debug issues.

@marcelm

Trying to address the above comments in one go, here’s an updated suggestion.

  • Only install triggers an auto-upgrade (not read-only commands)
  • It’s only triggered in a (writable) virtualenv and if --index-url wasn’t used (or more generally, when it has a chance of succeeding)
  • It’s done at the end (consistent with when the notice is shown now)
  • There’s a prompt (which maybe can be disabled for those who are fine with implicit updates), perhaps like this:
[notice] A new release of pip is available: 22.3 -> 22.3.1
[notice] Attempt to upgrade now (Y/n)?

If the answer is n:

[notice] To update manually, run pip install --upgrade pip

I wonder if it’d be useful to check how npm handles this…AFAIK the upgrade step is always explicit?

I don’t have experience with npm, but from what I can tell playing around with it for 15 minutes, it appears that npm doesn’t show upgrade notices on every install as pip does.

@notatallshaw

I’m not aware of any other program that upgrades itself without the user invoking a dedicated “self upgrade” command, and I think that doing so would be a source of difficult to debug issues.

FYI Conda does it by default! https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#auto-update-conda

The behavior is that you will be on the new version of conda the next time you run a conda command, the current conda command will run on the old version.

The main issue in my experience (and this is more to do with it being default) is it exposes a lot of users to unexpected bugs making it become extremely time critical to roll out fixes following major releases.

@marcelm

If a Windows user installs a package xxx using pip install xxx, then the pip.exe wrapper is in use, and cannot be upgraded. What would the automatic upgrade do in that case?

I don’t use Windows that much and don’t know what «cannot be upgraded means». Is this about pip install vs. python -m pip install? Then I assume that this situation can be detected, and an upgrade wouldn’t be attempted. That’s fine IMO – it doesn’t need to work in all cases.

Having said this, I’m basically -1 on the idea. I’m not aware of any other program that upgrades itself without the user invoking a dedicated “self upgrade” command, and I think that doing so would be a source of difficult to debug issues.

Thanks @notatallshaw for the Conda example, I use Conda regularly and wasn’t even aware it auto-updates.

Another example for auto-upgrades is Debian/Ubuntu’s «unattended upgrades» mechanism, and something like this can be enabled for other Linux distributions as well. If I remember correctly, Windows also updates itself quite regularly, even without any user interaction.

Running non-interactive auto-upgrades by default is not a good idea, I agree. I think there should at least be a prompt. Then possibly, for those who want, the prompt could be configured away, giving them non-interactive autoupgrades like Conda.

I assume you mostly meant «command-line programs somewhat like pip» and I agree it’s unusual for a command-line program to update itself, but then on the other hand, it’s also unusual to print upgrade notices.

That is probably my main gripe: By printing the notice, pip gives the impression that it is important to update, but then it just prints the command, not making it as easy as it could be. It feels weird to get me as a human involved in running a command that pip could just as well run itself. I realize now it’s not quite as easy as that in all cases, but I assume it could be made to work in many cases.

Finally, I should mention that removing the update notices altogether would also solve the problem for me …

@pfmoore

Finally, I should mention that removing the update notices altogether would also solve the problem for me …

Well, the --disable-pip-version-check option (which can be set in the config file) does that, but you said originally that wasn’t a suitable solution for you.

pip gives the impression that it is important to update

It’s important to upgrade for two main reasons:

  1. We don’t support any versions of pip other than the latest, so if you don’t upgrade regularly, you’ll be unsupported. That may be fine for you, of course.
  2. If you don’t use an up to date version of pip, you won’t get the benefit of new standards that get developed. For example, you could get known-problematic packages installed if your pip doesn’t support the «yanked» flag on PyPI. Or packages that are not compatible with your Python if you have a version of pip without support for the «requires_python» metadata. Too many people using out of date versions of pip would significantly increase the risk of breakage when we deploy new standards like this.

You can, of course, make your own choice around upgrading. But the upgrade notice does reflect our advice on whether you should or not.

The reasons we don’t automatically upgrade, but just let the user know, are basically:

  1. It’s impolite to upgrade someone’s software without giving them a choice. OS-level upgrades are a different matter, and there’s typically a lot of infrastructure to allow people (typically IT departments) to customise the process. A command line tool like pip doesn’t have that infrastructure, and people don’t expect automatic updates.
  2. It’s technically extremely tricky to do right (or even to detect when it’s possible to do it safely). A failed automatic update is the worst possible outcome, as you’ve now just broken the user’s ability to fix the issue as well.
  3. People should be managing the upgrades. Even though we say «there’s a new version, you should upgrade» that doesn’t mean that we expect people to immediately deploy the new pip to production1. Testing the new release and deploying it once you’re sure it works for you should be how you respond to that notification, and no automatic update can do that for you.

Footnotes

  1. Even though sadly, a lot of people do 🙁 ↩

@potiuk

My comment: All that @pfmoore writes is very accurate. Trying to upgrade automatically — especially ‘self-upgrade’ is a recipe for disaster. There are many scenarios that can go wrong.

Also as a general reasoning, it is generally a bad idea from security point of view. User should never be surprised by a new software coming from remote when they do not expect it to happen. In a number of scenarios it’s even enforced (permissions of the user, requiring sudo, selinux and a number of others) completely outside of the realm and capabilties of pip command that is being executed and sandbox it runs in and user it runs with.

@pradyunsg

@marcelm

Thanks all for your time engaging with me. I don’t think I have managed particularly well to convey that I don’t want to force an auto-update on anyone – my favorite option would be to prompt, and then it would be fully under the user’s control. However, it also appears to be more complicated than I thought (as always) and enthusiasm seems to be pretty low for the idea in general. I would not be able to submit a PR for this myself anyway, so I will let this go. It’s good to have your stance on the idea documented here. (Feel free to close.)

@pradyunsg

Thanks for this discussion folks! :)

@github-actions
github-actions
bot

locked as resolved and limited conversation to collaborators

Dec 19, 2022

Original: https://lwebapp.com/en/post/pip-install-error-guide

Question

When we use Python to develop, we usually use some useful third-party libraries. It is recommended to use pip to install, such as installing pandas

python -m pip install pandas

Enter fullscreen mode

Exit fullscreen mode

Under normal circumstances, there is no problem, but some small partners will encounter installation failures such as pip installation of third-party libraries and errors, pip install stuck and other installation failures.

For example, the following is the code that pip installs a third-party library to report an error

Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

Enter fullscreen mode

Exit fullscreen mode

I will summarize here the solutions for the failure of Python to install third-party libraries.

Solution

Option 1

The Python environment factor reports an error, check whether Python and pip under your computer are installed normally

# Print the current Python version
python --version

Enter fullscreen mode

Exit fullscreen mode

If the Python version information is printed out normally after running the above command, it means that it is normal. If an error is reported, it may be that the environment variables are not configured when installing Python under Windows. You can configure the Python environment variables, or directly reinstall Python to the C drive, so that there will be no problem with environment variables.

# print pip version
python -m pip --version

Enter fullscreen mode

Exit fullscreen mode

If the pip version information is printed out normally after running the above command, it means that it is normal. If an error is reported, you can use this command to install and upgrade

python -m ensurepip --upgrade

Enter fullscreen mode

Exit fullscreen mode

If you can’t run pip yet, you can also install pip manually

  1. Open https://bootstrap.pypa.io/get-pip.py
  2. Right click on the page — save as — save anywhere
  3. Execute python get-pip.py on the command line of the directory where the get-pip.py file is located

Another advantage of manually installing pip is that you can directly use global pip to install dependent packages, such as

pip install pandas

Enter fullscreen mode

Exit fullscreen mode

Option 2

Although pip is installed normally, sometimes it will prompt you that the version of pip is too low

WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

Enter fullscreen mode

Exit fullscreen mode

Run the following command to upgrade pip

python -m pip install --upgrade pip

Enter fullscreen mode

Exit fullscreen mode

Option 3

The third-party package name or version number is entered incorrectly. For example, I install a package called padas in the command line terminal

python -m pip install padas

Enter fullscreen mode

Exit fullscreen mode

The following error will appear

ERROR: Could not find a version that satisfies the requirement padas (from versions: none)
ERROR: No matching distribution found for padas

Enter fullscreen mode

Exit fullscreen mode

The error tells me that I typed padas, that the package and its version number cannot be found. At this time, you need to check whether the package name is entered correctly, the correct one should be pandas. (Of course, after the article is published, some developers may have released this package, which is only for demonstration)

There is also a problem that the version number may not exist. For example, I install a higher version of pandas

python -m pip install pandas==6.5

Enter fullscreen mode

Exit fullscreen mode

The following error will appear

ERROR: Could not find a version that satisfies the requirement pandas==6.5 (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0 , 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12 .0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1 , 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23 .0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0 , 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2 .1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.0rc0, 1.4.0 , 1.4.1)
ERROR: No matching distribution found for pandas==6.5

Enter fullscreen mode

Exit fullscreen mode

Obviously, this version number cannot be found, and it tells you all the version numbers that can be installed. We only need to select a version number that we need, or install the latest version by default without specifying a version number.

Option 4

The network quality and communication speed are different in different place, and the pip installation of dependencies will also encounter network timeout problems, such as the following errors

raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out.

Enter fullscreen mode

Exit fullscreen mode

It indicates that the network has timed out, and there is a problem connecting to pypi.org. This is the website hosting the python dependencies, and all pip packages are published on it.

We can set a longer timeout, because the network in most places is not completely unconnectable, but the speed is a bit slow. Here the --default-timeout is set to 200s

python -m pip --default-timeout=200 install pandas

Enter fullscreen mode

Exit fullscreen mode

Set a little more timeout, go have a cup of tea and wait for a while, and it may be downloaded.

Option 5

If you haven’t downloaded it after drinking tea, then consider changing the mirror source. For example, we switch to the mirror source of Tsinghua University.

# --index-url can be abbreviated as -i
python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ pandas

Enter fullscreen mode

Exit fullscreen mode

In addition to the official source and Tsinghua mirror source

  • Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple/
  • Official: https://pypi.org/

There are other mirror sources you can try

  • Aliyun: https://mirrors.aliyun.com/pypi/simple/
  • Douban: https://pypi.douban.com/simple/
  • Beijing Foreign Studies University https://mirrors.bfsu.edu.cn/pypi/web/simple/

Option 6

In addition to switching mirror sources, pip officially provides a variety of ways to install dependent packages

  1. Download the dependency package in advance, and then install it directly from the local path

For example, we can download the pandas distribution package file from the pip official website, and then execute the installation command in the directory where the local dependency package is located.

Install from Source Distribution

python -m pip install pandas-1.4.1.tar.gz

Enter fullscreen mode

Exit fullscreen mode

or install from Built Distributions

# Buildpacks for Windows platforms only
python -m pip install pandas-1.4.1-cp310-cp310-win_amd64.whl

Enter fullscreen mode

Exit fullscreen mode

List of all pandas distributions: pandas download files

  1. To install from any VCS (version control systems), use the following command format
python -m pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"

Enter fullscreen mode

Exit fullscreen mode

  • vcs: version control system name
  • protocol: protocol
  • repo_url: repository url
  • egg: package name
  • subdirectory: If the package is not in the project root directory, specify the subdirectory name

For example, install the pandas library directly from github

python -m pip install git+https://github.com/pandas-dev/pandas.git#egg=pandas

Enter fullscreen mode

Exit fullscreen mode

This method will pull the latest code from github for local construction, which takes a long time, and is usually the development version.

pip supports a lot of version control systems and protocols, see VCS Support

  1. Installation from github also supports manual local installation, clone the github repository of the dependent package directly, and execute it in the project directory
python setup.py install

Enter fullscreen mode

Exit fullscreen mode

In this way, the library built by this project is directly installed. In essence, it is similar to the remote method of using github. It needs to be compiled locally. It is usually used in the local development stage, or if you want to try the latest features of the project.

However, if you have network problems through pip install, this way of installing through github usually also has certain network problems.

Option 7

I have tried several of the above solutions, but none of them can perfectly meet my needs.

  • Although a long timeout is set, sometimes the network is very slow, and no matter how long the timeout is, it is a waste of time.
  • Compared with the official website, the mirror source has a slightly delayed synchronization time. The official pypi.org dependency package is the most stable. The same problem is also common in the npm package management of front-end development. The mirror source sometimes has unpredictable errors, and it is often fixed by switching to the official source (refer to NPM Install Error Guide).
  • If you directly download the source package to build, because many Python libraries are written by foreigners, the website is not in your country, the download speed is very slow when visiting other countries’ websites, downloading from github is just as slow (refer to GitHub Clone Is Very Slow).

We can consider some more scientific ways to surf the Internet to speed up access to the official website. After the acceleration, directly use pip install to install any third-party library. Basically, it can be completed in a few seconds. There is no need to set a timeout period, no need to switch mirror sources, and no need to worry about the delay of the installation package version. If you want to download the source package from the pip official website or installing Python third-party libraries remotely using github is very fast.

In addition, there are the following benefits

  • When you access some Python third-party library documents, you can also speed up access, such as pandas official website https://pandas.pydata.org/
  • When you go to github to learn the source code of open source projects, and use git clone to pull github open source projects, the speed is significantly improved
  • The technical documents searched by Google are often more accurate, and the top of the search results are the highly praised answers on stackoverflow, which are very useful
  • Visit some other great tech sites

Recommend a more scientific way on this Official Website ➜

If you don’t understand, please refer to my Hard-earned Experience ➜

Reference

  • pip Install Third-Party Library Error
  • Python official website
  • Python installation dependencies
  • pip Installation
  • NPM Install Reports an Error and Freezes, NPM Installation Guide
  • Python install Github package, offline package and online package

Введение

Pip — это пакетный менеджер для Python.

Если вы пользовались

Debian

/

Ubuntu

или

Red Hat

/

CentOS

/

Rocky

то уже сталкивались с пакетным менеджером
apt, yum или dnf

Установка в Linux

Чтобы установить pip в Debian-подобных Linux выполните

sudo apt install python3-pip

Проверить успех установки можно с помощью

pip3 —version

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Даже если Вы только что установили Python какие-то пакеты будут в системе по умолчанияю.

У меня, например, Flask и Jinja2 появились после установки

Flask

а остальные, похоже дефолтные.

pip list

Package Version
—————— ——-
astroid 2.4.1
click 7.1.2
colorama 0.4.3
Flask 1.1.2
isort 4.3.21
itsdangerous 1.1.0
Jinja2 2.11.2
lazy-object-proxy 1.4.3
MarkupSafe 1.1.1
mccabe 0.6.1
pip 20.1
pylint 2.5.2
setuptools 41.2.0
six 1.14.0
toml 0.10.0
Werkzeug 1.0.1
wrapt 1.12.1

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

Рекомендуется всегда использовать

виртуальное окружение
.

Чтобы установить один пакет, например,
Flask

python -m pip install flask

Чтобы установить сразу
Flask,

requests

и
Django

python -m pip install flask requests django

pip uninstall

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

pip uninstall flask requests django

Общая справка

pip help

pip list

pip help list

Cправка по команде list

pip list -o Покажет устаревшие пакеты

pip list -o

Package Version Latest Type
—————— ——- —— ——
lazy-object-proxy 1.4.3 1.5.0 wheel
pip 20.1 20.1.1 wheel
setuptools 41.2.0 47.1.1 wheel
six 1.14.0 1.15.0 wheel
toml 0.10.0 0.10.1 wheel

pip list -u Покажет пакеты с самой свежей версией

pip list -u

Package Version
———— ——-
astroid 2.4.1
click 7.1.2
colorama 0.4.3
Flask 1.1.2
isort 4.3.21
itsdangerous 1.1.0
Jinja2 2.11.2
MarkupSafe 1.1.1
mccabe 0.6.1
pylint 2.5.2
Werkzeug 1.0.1
wrapt 1.12.1

pip show

pip show Покажет информацию о пакете

pip show Jinja2

Name: Jinja2
Version: 2.11.2
Summary: A very fast and expressive template engine.
Home-page: https://palletsprojects.com/p/jinja/
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD-3-Clause
Location: c:usersandreiappdatalocalprogramspythonpython38-32libsite-packages
Requires: MarkupSafe
Required-by: Flask

Пример для Linux

pip show flask

Name: Flask
Version: 1.1.2
Summary: A simple framework for building complex web applications.
Home-page: https://palletsprojects.com/p/flask/
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD-3-Clause
Location: /home/andrei/.local/lib/python3.7/site-packages
Requires: Werkzeug, itsdangerous, Jinja2, click
Required-by:

Искать пакеты онлайн можно на сайте

pypi.org

известный также под названием the cheese shop.

Домашняя страница pip

pip.pypa.io

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

python3.8 -m pip install flask

Установить определённую версию пакета

Допустим, Вам нужна версия

flask

1.0

python -m pip install flask==1.0

Или

Django

не старше второй версии

python -m pip install ‘Django<2.0’

Обновить версию пакета

Если Вам нужно обновить, например,

flask

до последней версии — нужно использовать install с флагом -U

python -m pip install -U flask

Обновить версию pip

Если pip старый он сам подсказывает, что его нужно обновить предупреждением

WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.

You should consider upgrading via the ‘python -m pip install —upgrade pip’ command.

Чтобы обновить pip выполните

python -m pip install -U pip

или

python -m pip install —upgrade pip

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

Если Вы скачали пакет и хотите выполнить установку из папки — нужно использовать флаг -e

python -m pip install -e flask

WARNING: pip is being invoked by an old script wrapper

При выполнении pip может появиться предупреждение

pip -V

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.

Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.

To avoid this problem you can invoke Python with ‘-m pip’ instead of running pip directly.

pip 20.3.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

Чтобы его избежать вызывайте pip через python

python -m pip -V

pip 20.3.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

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

Если у вас несколько версий Python и нужно установить какой-то пакет только
для определённой версии, назовём её X.X, воспользуйтесь командой

pythonX.X -m pip install название_пакета —user —ignore-installed

Инструкция по установке Python на хостинге

Похожие статьи

Интерактивный режим
str: строки
: перенос строки
Списки []
if, elif, else
Циклы
Функции
try except
Пакеты
*args **kwargs
ООП
enum
Опеределить тип переменной Python
Тестирование с помощью Python
Работа с REST API на Python
Файлы: записать, прочитать, дописать, контекстный менеджер…
Скачать файл по сети
SQLite3: работа с БД
datetime: Дата и время в Python
json.dumps
Selenium + Python
Сложности при работе с Python
DJANGO
Flask
Скрипт для ZPL принтера
socket :Python Sockets
Виртуальное окружение
subprocess: выполнение bash команд из Python
multiprocessing: несколько процессов одновременно
psutil: cистемные ресурсы
sys.argv: аргументы командной строки
PyCharm: IDE
pydantic: валидация данных
paramiko: SSH из Python
enumerate
logging: запись в лог
Обучение программированию на Python

Понравилась статья? Поделить с друзьями:
  • Ошибка we were unable to find
  • Ошибка windows 10 с usb флешки
  • Ошибка warning s007 exception 0xc0000005 at 0x7ecabb
  • Ошибка we apologize the inconvenience
  • Ошибка windows 10 при обновлении системы