32位和64位Python会碰撞吗?(Will 32bit and 64bit Python collide? [duplicate])

可能重复: 我可以在OS X的现有32位安装上安装Python 2.7.1 64位吗?

我有一台运行10.7.3 Lion的MacBook Pro,默认安装Python 2.7 64bit。 我需要一个名为VPython的程序用于我所在的物理类,而VPython网站表示它不适用于64位Python。 所以我想知道我的MacBook上是否有32位和64位Python 2.7,如果他们会碰撞或导致问题。 我知道我可以做VPython的Python 3.1版本,但我认为教授给我们的大多数指令都是针对Python 2.7的。 感谢有关这方面的任何帮助。

Possible Duplicate: Can I install Python 2.7.1 64bit along side of an exsiting 32bit install on OS X?

I have a MacBook Pro running 10.7.3 Lion with Python 2.7 64bit installed by default. I need a program called VPython for a physics class I am in and VPython site says it doesnt work with 64 bit Python. So I was wondering if i had both 32 bit and 64bit Python 2.7 on my MacBook, if they would collide or cause problems. I know i could do Python 3.1 version of VPython, but I think most of the instructions the professor gives us is for Python 2.7. Thanks for any help regarding this.

最满意答案

如果不安装另一个python,你可以使用env在默认的32/64位之间切换:

$ python -c 'import sys; print sys.maxint' 9223372036854775807 $ export VERSIONER_PYTHON_PREFER_32_BIT=yes $ python -c 'import sys; print sys.maxint' 2147483648

请参阅OSX上的man python 。

您也可以使用arch -i386执行二进制文件:

$ /usr/bin/python2.7 -c 'import sys; print sys.maxint' 9223372036854775807 $ arch -i386 /usr/bin/python2.7 -c 'import sys; print sys.maxint' 2147483648

Without installing another python you can switch between the default 32/64 bits using env:

$ python -c 'import sys; print sys.maxint' 9223372036854775807 $ export VERSIONER_PYTHON_PREFER_32_BIT=yes $ python -c 'import sys; print sys.maxint' 2147483648

See man python on OSX.

You can also execute the binary with arch -i386:

$ /usr/bin/python2.7 -c 'import sys; print sys.maxint' 9223372036854775807 $ arch -i386 /usr/bin/python2.7 -c 'import sys; print sys.maxint' 2147483648

更多推荐