简体   繁体   English

"使用 pip 升级 python 版本"

[英]upgrade python version using pip

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.所以我在 Windows 7 64 位上安装了 python 2.7.3,我想增量升级到 2.7.5 版本。 I have pip installed and it works fine;我已经安装了 pip 并且工作正常; I just installed Django using it.我刚刚使用它安装了 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.现在它强制 pip 下载我想要的不是 Python 3 的最新版本。 2.7.5 starts downloading and I get the following error: 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.我输入了 install “pip install python”,它开始下载 python 版本 3。所以我取消了。 That won't override my main python 2.7.3 install?那不会覆盖我的主要 python 2.7.3 安装?

Curious.好奇的。

pip is designed to upgrade python packages and not to upgrade python itself. pip旨在升级python包而不是升级python本身。 pip shouldn't try to upgrade python when you ask it to do so. pip不应该在你要求它时尝试升级python。

Don't type pip install python but use an installer instead. 不要键入pip install python而是使用安装程序。

Basically, pip comes with python itself.Therefore it carries no meaning for using pip itself to install or upgrade python. 基本上,pip带有python本身。因此使用pip本身来安装或升级python没有任何意义。 Thus,try to install python through installer itself,visit the site " https://www.python.org/downloads/ " for more help. 因此,尝试通过安装程序本身安装python,访问网站“ https://www.python.org/downloads/ ”获取更多帮助。 Thank you. 谢谢。

py -m pip install --upgrade python.

也许这段代码会有所帮助。

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

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