Search code examples
python32bit-64bitpython-2.7vpython

Will 32bit and 64bit Python collide?


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.


Solution

  • 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