views:

49

answers:

2

I've installed Python 2.7 from the python-2.7.amd64.msi package from python.org. It installs and runs correctly, but seems to be in 32-bit mode, despite the fact that the installer was a 64 bit installer.

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, platform
>>> platform.architecture()
('64bit', 'WindowsPE')
>>> sys.maxint
2147483647

What can I do to install Python so that it actually runs in 64-bit mode?

+3  A: 

See here, maybe? It's from 2.6.1, but it seems to still apply. I haven't seen evidence to the contrary anywhere, at least. The gist of the matter (quoted from that link) is:

This is by design. In their infinitive wisdom Microsoft has decided to make the 'long' C type always a 32 bit signed integer - even on 64bit systems. On most Unix systems a long is at least 32 bit but usually sizeof(ptr).

eldarerathis
Thanks for the pointer, I thought sys.maxint was a reliable way to check the bitness of the current Python interpreter. It's funny - on Mac OS X, platform.architecture() is wrong for me and sys.maxint is correct. But on Windows, it's evidently the reverse...Thanks again.
RecessionCone
+1  A: 

On my x86-64 Linux:

$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, platform
>>> platform.architecture()
('64bit', 'ELF')
>>> sys.maxint
9223372036854775807

Of course, what matters more than integer size is how much memory you can allocate. Maybe your smaller ints won't really matter much, since Python will just promote to a long any way, but if you can allocate more than three gigs of memory, you'll still be enjoying the benefits of 64 bit execution.

sarnold