如何在安装了旧 Python 的同时使用新安装的 Python?

发布于 2024-09-14 18:23:23 字数 252 浏览 9 评论 0原文

全新安装 Windows 开发机器后,我安装了 Python 2.7。 很快我就意识到这是一个错误,因为我使用的许多软件包只能在 Python 2.6 上运行。所以我也安装了 2.6,现在两个都安装了。

如何让一切都可以使用 Python 2.6 而不是 Python 2.7?

每次我安装一个包时,它都会安装到 Python 2.7 中。每次我运行 .py 文件时,它都会使用 2.7 解释器运行。

有没有办法完全卸载Python 2.7?

After a fresh installation of my Windows dev machine, I installed Python 2.7.
Quickly I learnt that this was a mistake as many of the packages I use only work on Python 2.6. So I installed 2.6 also and now I have both installations.

How can I make everything work with Python 2.6 instead of Python 2.7?

Every time I install a package it installs into Python 2.7. Every time I run a .py file it runs using the 2.7 interpreter.

Is there a way to completely uninstall Python 2.7?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戒ㄋ 2024-09-21 18:23:23

大多数 python 安装都附带一个卸载程序,该卸载程序显示在 Windows 上的“添加/删除程序”中。

当然可以安装多个版本。在我的 Windows 机器上,我有 Python 2.5、2.6、2.7 和 3.1。 “默认”python 是系统路径中第一个出现的 python。另外(取决于您使用的安装程序),您可能必须更改注册表中 .py 文件的处理程序。如果要运行特定版本,请从相应的目录 (C:\Python26\python.exe) 启动 python.exe。

管理包也应该很容易。 EXE 包通常与 python 版本绑定。例如,PIL 具有适用于 Python 2.5 的 PIL-1.1.7.win32-py2.5.exe 和适用于 Python 2.6 的 PIL-1.1.7.win32-py2.6.exe 等安装程序。其他包可以放入正确的 site-packages 文件夹中。

Most python installations come with an uninstaller that shows up in Add/Remove programs on Windows.

It is certainly possible to have several versions installed. On my windows machine, I have Python 2.5, 2.6, 2.7 and 3.1. The "default" python is the one which occurs first in your system path. Also (depending on which installer you used), you may have to change the handler for .py files in the registry. If you want to run a particular version, then start python.exe from the appropriate directory (C:\Python26\python.exe).

Managing packages should be pretty easy too. EXE packages are generally tied to the python version. PIL, for example has installers like PIL-1.1.7.win32-py2.5.exe for Python 2.5 and PIL-1.1.7.win32-py2.6.exe for Python 2.6. Other packages can be dropped into the right site-packages folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文