使用 pip 升级 python 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16769109/
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-18 23:36:42  来源:igfitidea点击:

upgade python version using pip

pythonupgradepip

提问by Snerd

So I have python 2.7.3 installed on Windows 7 64 bit and I want to do an incremental upgrade to version 2.7.5. I have pip installed and it works fine; I just installed Django using it.

所以我在 Windows 7 64 位上安装了 python 2.7.3,我想对版本 2.7.5 进行增量升级。我已经安装了 pip 并且运行良好;我刚刚使用它安装了 Django。

I ran into this command: pip install --upgrade 'python>=2.7,<2.7.99'

我遇到了这个命令: pip install --upgrade 'python>=2.7,<2.7.99'

Now it forces pip to download the latest version that is not Python 3 which is what I want. 2.7.5 starts downloading and I get the following error:

现在它强制 pip 下载不是 Python 3 的最新版本,这正是我想要的。2.7.5 开始下载,出现以下错误:

    Downloading/unpacking python>=2.7,<2.7.99
      Downloading Python-2.7.5.tar.bz2 (12.1MB): 12.1MB downloaded
      Running setup.py egg_info for package python
        Traceback (most recent call last):
          File "<string>", line 16, in <module>
          File "c:\users\name\appdata\local\temp\pip-build-name\python\setup.py", line 33, in <module>
            COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
        TypeError: argument of type 'NoneType' is not iterable
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):

      File "<string>", line 16, in <module>

      File "c:\users\name\appdata\local\temp\pip-build-name\python\setup.py", line 33, in <module>

        COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))

    TypeError: argument of type 'NoneType' is not iterable

    ----------------------------------------
    Command python setup.py egg_info failed with error code 1 in c:\users\name\appdata\local\temp\pip-build-name\python

Also I am new to pip. When I cancel a download is that safe? I typed install "pip install python" and it started downloading version python version 3. So I cancelled. That won't override my main python 2.7.3 install?

我也是 pip 的新手。当我取消下载时是否安全?我输入 install "pip install python" 然后它开始下载 python version 3. 所以我取消了。这不会覆盖我的主要 python 2.7.3 安装吗?

Curious.

好奇的。

采纳答案by Boud

pipis designed to upgrade python packages and not to upgrade python itself. pipshouldn't try to upgrade python when you ask it to do so.

pip旨在升级python包而不是升级python本身。pip当你要求它这样做时,不应该尝试升级 python。

Don't type pip install pythonbut use an installer instead.

不要输入,pip install python而是使用安装程序。

回答by Shobhit Srivastava

Basically, pip comes with python itself.Therefore it carries no meaning for using pip itself to install or upgrade python. Thus,try to install python through installer itself,visit the site "https://www.python.org/downloads/" for more help. Thank you.

基本上,pip是python自带的,所以用pip本身安装或升级python没有任何意义。因此,尝试通过安装程序本身安装 python,访问站点“ https://www.python.org/downloads/”以获得更多帮助。谢谢你。