是软删除旧版本?还是硬删除/清除旧版本?覆盖安装?
我曾经看到过一种特殊的安装/升级过程,使用Python安装的“分段”方法,将不同版本分开并保持独立但功能正常。不确定是否为标准的事实方式。
我也想知道Revo是否过于热衷,可能会导致擦除仍然需要的残留物,例如环境/PATH变量。
(Win7 x64,32位Python)
这篇文章已经有近5年的历史了!Python-2.7将在2020年停止从python.org接收官方更新。此外,Python-3.7已经发布。请查看Python-Future,了解如何使您的Python-2代码与Python-3兼容。为更新conda,文档现在建议在每个conda环境中使用conda update --all
以更新所有包和该版本的Python可执行文件。另外,由于他们将名称更改为Anaconda,我不知道Windows注册表键是否仍然相同。
自2015年6月以来,Python(x,y)没有任何更新,因此我认为可以假设它已被放弃。
更新如@cxw下面的评论所述,这些答案是针对相同位版本而言,而我所说的位版本是指64位与32位。例如,这些答案适用于从64位Python-2.7.10更新到64位Python-2.7.11,即相同的位版本。虽然可以安装两个不同位版本的Python,但需要进行一些黑客攻击,因此我建议读者在没有进行黑客攻击的情况下,如果要切换位版本,则应先删除其他位版本。
更新内容 以下是您需要翻译的内容:PATH
和注册表的选项。提取后,在您的 bin
中创建到 conda
的符号链接,或从 PyPI 安装 conda。然后在 Anaconda/Miniconda 根目录的 bin 文件夹中创建另一个名为 conda-activate
的符号链接,指向 activate
。现在 Anaconda/Miniconda 就像 Ruby RVM 一样方便使用。只需使用 conda-activate root
启用 Anaconda/Miniconda。conda update --all
来保持每个conda环境的更新。$ ln /c/Python33/python.exe python3
)。If OP has 2.7.x and wants to install newer version of 2.7.x, then
It is recommended to uninstall any other Python distribution before installing Python(x,y)
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.Other Python 2.7 Installations On Windows, ActivePython 2.7 cannot coexist with other Python 2.7 installations (for example, a Python 2.7 build from python.org). Uninstall any other Python 2.7 installations before installing ActivePython 2.7.
sage -upgrade
command.Anaconda can be updated by using the conda
command:
conda update --all
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.
Anaconda will likely disrupt any other Python installations. Installation uses MSI installer.
[UPDATE: 2016-05-16] Anaconda and Miniconda now use .exe
installers and provide options to disable Windows PATH
and Registry alterations.
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 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.
App\lib\site-packages
and App\Scripts
could be copied to the new installation, but if this didn't work then reinstalling all packages might have been necessary. Use pip list
to see what packages were installed and their versions. Some were installed by PortablePython. Use easy_install pip
to install pip if it wasn't installed.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
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.
我希望这能消除任何困惑。
C:\Python27
和C:\Python33
;如果你是在Mac上,你会看到/Library/Frameworks/Python/Versions/2.7.x
和/Library/Frameworks/Python/Versions/3.3.x
;如果你是在Linux上,你可能已经安装了这两个版本。传统的做法是使用Python-2.7,并将Python-3.3的二进制文件建立符号链接到python33
。另请参见Python2orPython3和Python 2 vs Python 3。我个人太懒了,不愿意切换到3.3。 - Mark MikofskiC:\Python27_x86
中:msiexec /a "python-2.7.11.msi" TARGETDIR="C:\Python27_x86" /qn /l*v python27_x86_install.log
。另一种选择是从源代码构建,或尝试Bootstrap Python。 - Mark Mikofski官方Python .msi安装程序旨在替换:
快照安装程序旨在替换较低微版本的任何快照版本。
其他版本不一定兼容,因此如果您想卸载旧版本,则需要手动执行。并且,还要卸载任何为其编写的第三方模块:
bdist_wininst
包(Windows .exe
s)的模块,请在卸载版本之前卸载它们,否则如果它具有自定义逻辑,则卸载程序可能无法正常工作setuptools
/pip
安装的位于Lib\site-packages
中的模块可以在卸载后直接删除%APPDATA%/Python/PythonXY/site-packages
,也可以删除我一直只是在旧版本的基础上安装新版本,从未遇到任何问题。但请确保您的路径已更新以指向新版本。