0 votes
1 view
in Python by (31.7k points)

I need a way to tell what mode the shell is in from within the shell.

I've tried looking at the platform module but it seems only to tell you about "about the bit architecture and the linkage format used for the executable": the binary is compiled as 64bit though (I'm running on OS X 10.6) so it seems to always report 64bit even though I'm using the methods described here to force 32bit mode).

1 Answer

0 votes
by (75.1k points)

You can determine whether your python shell is executing in 32bit or 64bit mode on OS X by using the following ways:-

When you are starting your Python interpreter in the terminal/command line and if you see the following line then you can assume that your system has the requirement that you want:-

Python 2.7.2 (default, Jun 12 2011, 14:24:46)[MSC v.1500 64 bit (AMD64)] on win32

Where [MSC v.1500 64 bit (AMD64)] means 64-bit Python.

If you want to check it by running Python code than you can run the following piece of code:-

import struct

print(struct.calcsize("P") * 8)