简体   繁体   English

如何在 python 2.7 上升级 pip?

[英]How do I upgrade pip on python 2.7?

I'm a complete newbie, giving my first baby steps into programming and automation testing.我是一个完整的新手,让我的第一个婴儿步骤进入编程和自动化测试。 I have Python 2.7.12 installed and pip version 8.1.1 with it.我安装了 Python 2.7.12 和 pip 版本 8.1.1。 I want to update pip but all the commands provided by many users (while I was searching about this subject) don't work, like for example:我想更新 pip 但许多用户提供的所有命令(当我搜索这个主题时)都不起作用,例如:

python -m pip install --upgrade pip (doesn't recognize pip)

or或者

pip -V

python window - nameerror python window - 名称错误

Sure I'm making a terrible newbie mistake... Can you help me please?当然我犯了一个可怕的新手错误......你能帮我吗? Thanks in advance.提前致谢。

Try Using :-尝试使用:-

py -m pip install --upgrade pip

because on certain versions of windows/python, python is not recognized as an valid command.因为在某些版本的 windows/python 上, python不被识别为有效命令。

Make sure that you have the correct path in your windows command line like (in my case):确保您的 Windows 命令行中有正确的路径,例如(在我的情况下):

set PATH=%PATH%;C:\Users\iyv\AppData\Local\Programs\Python\Python35

set PATH=%PATH%;C:\Users\iyv\AppData\Local\Programs\Python\Python35\Lib\site-packages\pip

Otherwise you could try installing an interpreter like PyCharm, and doing the update through their platform.否则,您可以尝试安装像 PyCharm 这样的解释器,并通过他们的平台进行更新。

Python does not maintain version 2.7 now; Python 现在不维护 2.7 版本; it prompts:它提示:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained.弃用:Python 2.7 的生命周期已于 2020 年 1 月 1 日结束。请升级您的 Python,因为不再维护 Python 2.7。 pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. pip 21.0 将于 2021 年 1 月停止支持 Python 2.7。有关 pip 中 Python 2 支持的更多详细信息, 访问https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 将取消对此功能的支持。

To solve this problem, use要解决此问题,请使用

easy_install pip==20.3.4

(python version used: 2.7.13) (使用的python版本:2.7.13)

4.21.2021 4.21.2021

Run as administrator以管理员身份运行

$ python -V
Python 2.7.5
$ curl -fsSL -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
$ python get-pip.py --no-python-version-warning && rm -f get-pip.py
$ python -m pip --version
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM