是否可以在同一台PC上安装python 3和2.6?

时间:2022-03-25 18:16:28

How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.

我该怎么办?原因是我想尝试一些pygame,但我目前安装了python 3并且一直在学习。我也有兴趣尝试wxpython或类似的东西,但我还没有看过它们的兼容性。

EDIT:: im on a windows vista 64-bit

编辑:: im在Windows Vista 64位上

7 个解决方案

#1


9  

If you are on Windows, then just install another version of Python using the installer. It would be installed into another directory.

如果您使用的是Windows,则只需使用安装程序安装另一个版本的Python即可。它将被安装到另一个目录中。

Then if you install other packages using the installer, it would ask you for which python installation to apply. If you use installation from source or easy_install, then just make sure that when you install, you are using the one of the proper version.

然后,如果使用安装程序安装其他软件包,它将询问您应用哪个python安装。如果您使用source或easy_install进行安装,那么只需确保在安装时使用的是正确版本。

If you have many packages installed in your current python-3, then just make a zip backup of your current installation just in case.

如果您在当前的python-3中安装了许多软件包,那么只需对当前安装进行zip备份以防万一。

#2


3  

Erm... yes. I just installed Python 3.0 on this computer to test it. You haven't specified your operating system, but I'm running Ubuntu 9.04 and I can explicitly specify the version of Python I want to run by typing python2.5 myscript.py or python3.0 myscript.py, depending on my needs.

呃......是的。我刚刚在这台计算机上安装了Python 3.0来测试它。你没有指定你的操作系统,但是我正在运行Ubuntu 9.04,我可以通过键入python2.5 myscript.py或python3.0 myscript.py来显式指定我想运行的Python版本,具体取决于我的需要。

#3


3  

Typically python is installed with a name like python2.6, so you can have more than one. There may be a symlink from python to one of the numbered files. Quite workable.

通常,python的安装名称类似于python2.6,因此您可以拥有多个。可能有一个从python到其中一个编号文件的符号链接。相当可行。

#4


2  

Yes, it is possible.

对的,这是可能的。

I maintain 3 python installations (2.5, 2.6, 3.0). The only issue that could be confusing is figuring out which Python version takes precedence in PATH variable (if any) . To execute a script for a specific version, you would go into the python directory for that version

我维护3个python安装(2.5,2.6,3.0)。可能令人困惑的唯一问题是确定哪个Python版本优先于PATH变量(如果有的话)。要为特定版本执行脚本,您将进入该版本的python目录

C:\Python25\ , C:\Python26\, C:\Python30\, etc.

C:\ Python25 \,C:\ Python26 \,C:\ Python30 \等。

Drop the file in there, and run "python.exe file.py" from command-line.

将文件放在那里,然后从命令行运行“python.exe file.py”。

You could even rename each python.exe to python25.exe python26.exe python30.exe and have each directory in PATH so it would be easy to execute any script on any version.

您甚至可以将每个python.exe重命名为python25.exe python26.exe python30.exe,并将每个目录都放在PATH中,以便在任何版本上执行任何脚本都很容易。

#5


1  

I would assume it'd be the same as running two versions of 2.x; as long as they're each in their own directory you should be OK.

我认为它与运行两个版本的2.x相同;只要他们各自在他们自己的目录中你应该没问题。

#6


1  

You certainly can. On Mac Ports, there's a tool called python_select that lets you switch among python versions; if nothing like it exists on Windows (momentary googling didn't reveal one), it could certainly be written.

你当然可以。在Mac Ports上,有一个名为python_select的工具可以让你在python版本之间切换;如果在Windows上没有任何类似的东西(瞬间的谷歌搜索没有透露一个),它肯定可以写。

#7


0  

You can set up virtual python environments using virtualenv.

您可以使用virtualenv设置虚拟python环境。

#1


9  

If you are on Windows, then just install another version of Python using the installer. It would be installed into another directory.

如果您使用的是Windows,则只需使用安装程序安装另一个版本的Python即可。它将被安装到另一个目录中。

Then if you install other packages using the installer, it would ask you for which python installation to apply. If you use installation from source or easy_install, then just make sure that when you install, you are using the one of the proper version.

然后,如果使用安装程序安装其他软件包,它将询问您应用哪个python安装。如果您使用source或easy_install进行安装,那么只需确保在安装时使用的是正确版本。

If you have many packages installed in your current python-3, then just make a zip backup of your current installation just in case.

如果您在当前的python-3中安装了许多软件包,那么只需对当前安装进行zip备份以防万一。

#2


3  

Erm... yes. I just installed Python 3.0 on this computer to test it. You haven't specified your operating system, but I'm running Ubuntu 9.04 and I can explicitly specify the version of Python I want to run by typing python2.5 myscript.py or python3.0 myscript.py, depending on my needs.

呃......是的。我刚刚在这台计算机上安装了Python 3.0来测试它。你没有指定你的操作系统,但是我正在运行Ubuntu 9.04,我可以通过键入python2.5 myscript.py或python3.0 myscript.py来显式指定我想运行的Python版本,具体取决于我的需要。

#3


3  

Typically python is installed with a name like python2.6, so you can have more than one. There may be a symlink from python to one of the numbered files. Quite workable.

通常,python的安装名称类似于python2.6,因此您可以拥有多个。可能有一个从python到其中一个编号文件的符号链接。相当可行。

#4


2  

Yes, it is possible.

对的,这是可能的。

I maintain 3 python installations (2.5, 2.6, 3.0). The only issue that could be confusing is figuring out which Python version takes precedence in PATH variable (if any) . To execute a script for a specific version, you would go into the python directory for that version

我维护3个python安装(2.5,2.6,3.0)。可能令人困惑的唯一问题是确定哪个Python版本优先于PATH变量(如果有的话)。要为特定版本执行脚本,您将进入该版本的python目录

C:\Python25\ , C:\Python26\, C:\Python30\, etc.

C:\ Python25 \,C:\ Python26 \,C:\ Python30 \等。

Drop the file in there, and run "python.exe file.py" from command-line.

将文件放在那里,然后从命令行运行“python.exe file.py”。

You could even rename each python.exe to python25.exe python26.exe python30.exe and have each directory in PATH so it would be easy to execute any script on any version.

您甚至可以将每个python.exe重命名为python25.exe python26.exe python30.exe,并将每个目录都放在PATH中,以便在任何版本上执行任何脚本都很容易。

#5


1  

I would assume it'd be the same as running two versions of 2.x; as long as they're each in their own directory you should be OK.

我认为它与运行两个版本的2.x相同;只要他们各自在他们自己的目录中你应该没问题。

#6


1  

You certainly can. On Mac Ports, there's a tool called python_select that lets you switch among python versions; if nothing like it exists on Windows (momentary googling didn't reveal one), it could certainly be written.

你当然可以。在Mac Ports上,有一个名为python_select的工具可以让你在python版本之间切换;如果在Windows上没有任何类似的东西(瞬间的谷歌搜索没有透露一个),它肯定可以写。

#7


0  

You can set up virtual python environments using virtualenv.

您可以使用virtualenv设置虚拟python环境。