+3 votes
in Programming Languages by (7.0k 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

0 votes
by (29.1k points)

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
>>> import platform
>>> print(platform.architecture()[0])

Related questions