Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k 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 (106k 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)

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Dec 5, 2020 in Python by laddulakshana (12.7k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...