I am not able to find any command to check if my python is compiled for 32bit system or 64bit system.
I tried
python
and it only tells the version
Also when I go to python download site they have one version of python for linux but two versions for mac i.e 32bit and 64bit.
Best Answer
For Python 2.6 and above, you can use
sys.maxsize
as documented here:UPDATE: I notice that I didn't really answer the question posed. While the above test does accurately tell you whether the interpreter is running in a 32-bit or a 64-bit architecture, it doesn't and can't answer the question of what is the complete set of architectures that this interpreter was built for and could run in. As was noted in the question, this is important for example with Mac OS X universal executables where one executable file may contain code for multiple architectures. One way to answer that question is to use the operating system
file
command. On most systems it will report the supported architectures of an executable file. Here's how to do it in one line from a shell command line on most systems:Using the default system Python on OS X 10.6, the output is:
On one Linux system:
BTW, here's an example of why
platform
is not reliable for this purpose. Again using the system Python on OS X 10.6: