5

我用的是windows xp。

我正在尝试在 powershell 中使用 Python。在我的电脑上,我安装了 Python 3.3 和 2.7。我正在尝试运行 2.7,但是每当我在 powershell 中键入“python”时,它都会打开 3.3。

如何选择要运行的 Python 版本?

4

2 回答 2

10

在 powershell 中,输入以下内容:

$Env:PY_PYTHON = 2

然后尝试使用命令“py”。它应该启动 Python 2.7。如果你想再次运行 Python 3.3,“py -3”就可以了。

于 2012-11-11T04:57:14.223 回答
1

像 Python Select 这样的东西?Windows 支持是实验性的,但可能值得一试。

https://github.com/Activestate/pythonselect

还有 switchpy,虽然它只支持 Python 3.2。

apipes.blogspot.com/2010/10/switchpy.html?m=1

于 2012-11-11T04:23:11.100 回答