如何更新 Python pip?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52992486/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:13:57  来源:igfitidea点击:

How to update Python pip?

pythonpip

提问by Caleb Hawn

I've had to install Python packages and libraries using pip, but every time I do, it says I'm using an older version of pip, and that v18.1 is available by running the command

我不得不使用 pip 安装 Python 包和库,但每次我这样做时,它都说我使用的是旧版本的 pip,并且可以通过运行命令来获得 v18.1

python -m pip install --upgrade pip

python -m pip install --upgrade pip

When I run this command, it just says the same thing. It apparently can't update itself because it's outdated. Is there any way to get around this, maybe by manually updating it?

当我运行这个命令时,它只是说同样的事情。它显然无法自我更新,因为它已经过时了。有什么办法可以解决这个问题,也许是通过手动更新它?

Thanks in advance, community!

提前致谢,社区!

Update: The OS I'm using is currently Windows 10 and Python 3.6.4. The following screenshot is what outputs when running the command.

更新:我目前使用的操作系统是 Windows 10 和 Python 3.6.4。以下屏幕截图是运行命令时的输出。

enter image description here

在此处输入图片说明

回答by Pitto

Upgrading pip

升级pip

On Linux or macOS:

在 Linux 或 macOS 上:

pip install -U pip

On Windows:

在 Windows 上:

python -m pip install -U pip

回答by eiram_mahera

If you are on linux try this -

如果你在 linux 上试试这个 -

sudo su root

apt-get purge -y python-pip

wget https://bootstrap.pypa.io/get-pip.py

python ./get-pip.py

apt-get install python-pip

or

或者

sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip

回答by KAM

Try with "python -m pip install --upgrade pip --user" It worked with me and I am with Win10.

尝试使用“python -m pip install --upgrade pip --user”它与我一起工作,我使用的是 Win10。