本文介绍了如何更新Python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从2012年初开始安装2.7版.对于在安装最新版本之前是否应该完全卸载并擦除此版本,我无法达成共识.

I have version 2.7 installed from early 2012. I can't find any consensus on whether I should completely uninstall and wipe this version before putting on the latest version.

软"-删除旧版本吗?硬删除/清除旧版本?在顶部安装?

"Soft"-removing old versions? Hard-removing/wiping old versions? Installing over top?

我在某处看到了一个特殊的安装/升级过程,该过程使用Python安装的分段"方法,将不同的版本分开并保持功能.不确定这是否是事实上的标准.

I've seen somewhere a special install/upgrade process using a "segmenting" method of Python installations, keeping different versions separate and apart, but functional. Not sure if this is the standard, de facto way.

我还想知道Revo是否太过热情,是否可能导致清除仍然需要的残留物(例如环境/PATH变量)的问题.

I also wonder if Revo gets too overzealous and may cause issues with wiping out still-needed remnants, like environment/PATH variables.

(Win7 x64,32位Python)

(Win7 x64, 32-bit Python)

推荐答案

  • if using MSI installer from the official Python website, just install over old version, installer will issue warning that it will remove and replace the older version; looking in "installed programs" in "control panel" before and after confirms that the old version has been replaced by the new version; newer versions of 2.7.x are backwards compatible so this is completely safe and therefore IMHO multiple versions of 2.7.x should never necessary.
  • if building from source, then you should probably build in a fresh, clean directory, and then point your path to the new build once it passes all tests and you are confident that it has been built successfully, but you may wish to keep the old build around because building from source may occasionally have issues. See my guide for building Python x64 on Windows 7 with SDK 7.0.
  • if installing from a distribution such as Python(x,y), see their website.

  • 思想冠层使用MSI,并将全部安装到Program Files\Enthoughthome\AppData\Local\Enthought\Canopy\App中个用户或每个用户.通过使用内置的更新工具来更新较新的安装.请参阅其文档.
  • ActiveState 也使用MSI,因此可以在较旧的安装之上安装较新的安装.请参阅他们的安装说明.

  • Enthought Canopy uses an MSI and will install either into Program Files\Enthought or home\AppData\Local\Enthought\Canopy\App for all users or per user respectively. Newer installations are updated by using the built in update tool. See their documentation.
  • ActiveState also uses an MSI so newer installations can be installed on top of older ones. See their installation notes.

  • Sage 建议您将其安装到虚拟机中,并提供一个Oracle VirtualBox可以用于此目的的图像文件.发出sage -upgrade命令在内部处理升级.
  • Anaconda 可以是使用conda命令更新:

  • Sage recommends that you install it into a virtual machine, and provides a Oracle VirtualBox image file that can be used for this purpose. Upgrades are handled internally by issuing the sage -upgrade command.
  • Anaconda can be updated by using the conda command:

    conda update --all
    

    Anaconda/Miniconda使用户可以创建环境来管理多个Python版本,包括Python-2.6、2.7、3.3、3.4和3.5. Anaconda/Miniconda的根安装当前基于Python-2.7或Python-3.5.

    Anaconda/Miniconda lets users create environments to manage multiple Python versions including Python-2.6, 2.7, 3.3, 3.4 and 3.5. The root Anaconda/Miniconda installations are currently based on either Python-2.7 or Python-3.5.

    [[UPDATE: 2016-05-16] Anaconda and Miniconda now use .exe installers and provide options to disable Windows PATH and Registry alterations.

    因此,可以根据自己的安装方式和安装过程中选择的选项,在不中断现有Python安装的情况下安装Anaconda/Miniconda.如果使用.exe安装程序,并且 禁用了更改Windows PATH和注册表的选项,则将禁用所有以前的Python安装 ,而只需卸载Anaconda/Miniconda安装应恢复原始的Python安装,但Windows注册表Python\PythonCore键除外.

    Therefore Anaconda/Miniconda can be installed without disrupting existing Python installations depending on how it was installed and the options that were selected during installation. If the .exe installer is used and the options to alter Windows PATH and Registry are not disabled, then any previous Python installations will be disabled, but simply uninstalling the Anaconda/Miniconda installation should restore the original Python installation, except maybe the Windows Registry Python\PythonCore keys.

    Anaconda/Miniconda不管安装选项如何,都会进行以下注册表HKCU\Software\Python\ContinuumAnalytics\具有以下项:HelpInstallPathModulesPythonPath-官方Python也注册了这些项,但在Python\PythonCore.还为Anaconda \ Miniconda注册了卸载信息.除非在安装过程中选择在Windows中注册"选项,否则它不会创建PythonCore,因此像Visual Studio的Python工具这样的集成不会自动看到Anaconda/Miniconda.如果启用了注册Anaconda/Miniconda 的选项,那么我认为您现有的Python Windows注册表项将被更改,并且卸载可能不会恢复它们.

    Anaconda/Miniconda makes the following registry edits regardless of the installation options: HKCU\Software\Python\ContinuumAnalytics\ with the following keys: Help, InstallPath, Modules and PythonPath - official Python registers these keys too, but under Python\PythonCore. Also uninstallation info is registered for Anaconda\Miniconda. Unless you select the "Register with Windows" option during installation, it doesn't create PythonCore, so integrations like Python Tools for Visual Studio do not automatically see Anaconda/Miniconda. If the option to register Anaconda/Miniconda is enabled, then I think your existing Python Windows Registry keys will be altered and uninstallation will probably not restore them.

    如果OP具有2.7.x,并且要安装其他版本,则 eg < = 2.6.x或> = 3.xx,然后并排安装不同版本很好您必须选择要与*.py文件关联的Python版本(如果有),以及要在路径中使用的版本,但是如果使用 BASH . AFAIK 2.7.x向后兼容2.6.x,因此不需要IMHO并排安装,但是Python-3.xx不向后兼容,因此我的建议是将Python-2.7放在您的路径上并具有通过创建指向可执行文件的快捷方式python3(这是Linux上的常见设置),可以将python-3作为可选版本. Windows上官方的Python默认安装路径为

    If OP has 2.7.x and wants to install a different version, e.g. <=2.6.x or >=3.x.x, then installing different versions side-by-side is fine. You must choose which version of Python (if any) to associate with *.py files and which you want on your path, although you should be able to set up shells with different paths if you use BASH. AFAIK 2.7.x is backwards compatible with 2.6.x, so IMHO side-by-side installs is not necessary, however Python-3.x.x is not backwards compatible, so my recommendation would be to put Python-2.7 on your path and have Python-3 be an optional version by creating a shortcut to its executable called python3 (this is a common setup on Linux). The official Python default install path on Windows is

    • C:\ Python33 for 3.3.x(最新2013-07-29)
    • C:\ Python32 for 3.2.x
    • & c.
    • C:\ Python27 for 2.7.x(2013-07-29最新)
    • C:\ Python26 for 2.6.x
    • & c.

    如果OP不是在更新Python,而只是在更新软件包,他们可能希望研究 virtualenv ,以使其开发项目专用的软件包的不同版本分开. Pip 也是更新软件包的好工具.如果软件包使用二进制安装程序,我通常会在安装新软件包之前先卸载旧软件包.

    If OP is not updating Python, but merely updating packages, they may wish to look into virtualenv to keep the different versions of packages specific to their development projects separate. Pip is also a great tool to update packages. If packages use binary installers I usually uninstall the old package before installing the new one.

    我希望这可以消除任何混乱.

    I hope this clears up any confusion.

    这篇关于如何更新Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-12 00:23