How can I get rid of this warning to upgrade from

2019-02-24 19:15发布

问题:

Whenever I use pip, it warns me that my pip is out of date and that I need to upgrade it by doing pip install --upgrade pip.

But when I do that it seemingly has no effect and simply tells me the same thing. It's circular!

How can I fix this? See below

$ pip install --upgrade pip
You are using pip version 6.0.8, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: pip in my-virtualenv/lib/python2.7/site-packages

EDIT: I'm running Red Hat Enterprise Linux (on AWS). So I just tried uninstalling and reinstalling python-pip. When I did that it tells me it will install pip 6.1.1.-1.21.amzn1. How can I make it install the newer version??

回答1:

This one was resolved here:

How to suppress pip upgrade warning?

There is a known issue with pip where it will print that warning even if you have the version of pip that shipped with your OS. It is safe to get rid of the warning with this command:

mkdir -p $HOME/.config/pip
printf "[global]\ndisable-pip-version-check = True\n" \
  > $HOME/.config/pip/pip.conf


回答2:

You need to run:

pip install --upgrade pip

twice.

The first time it upgrades to version 8.1.0 and the second time to 8.1.1. After this there will be no warnings anymore.



回答3:

You can install pip using system package manager,

for ubuntu/debian: apt-get install python-pip

for arch: pacman -S python-pip

In this the package manager will update pip every time a new version will be available for your distribution.



回答4:

You can fix it with:

pip3 install --upgrade pip

It worked for me