+3 votes
in Programming Languages by (56.8k points)
If I type python on the command line, it gives me the version of the python installed on my machine. I want to know whether the machine is running 32 bits or 64 bits python. How can I check that?

1 Answer

+1 vote
by (349k points)
selected by
 
Best answer

There are a couple of ways to check whether 64 bits or 32 bits Python is installed on the machine. Try out one of the following approaches highlighted in bold:

[root@root]$ python
Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct; print struct.calcsize("P") * 8
64
>>> import platform
>>> print(platform.architecture()[0])
64bit


...