How do I determine if my python shell is executing in 32bit or 64bit mode on OS X?

How do I determine if my python shell is executing in 32bit or 64bit mode on OS X?

Asked on November 10, 2018 in Python.
Add Comment


  • 3 Answer(s)

    When starting the Python interpreter in the command line you may also see a line like this:

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

    Fundamentally a variant on Matthew Marshall’s answer (with struct from the std.library):

    import struct
    print struct.calcsize("P") * 8
    
    Answered on November 10, 2018.
    Add Comment

    Try using ctypes to get the size of a void pointer:

    import ctypes
    print ctypes.sizeof(ctypes.c_voidp)
    
    Answered on November 10, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.