How to Check if Python is 32-bit or 64-bit?

Estimated read time 2 min read

To check if your Python installation is 32-bit or 64-bit, you can run the following command in the Python interpreter:

import platform
print(platform.architecture())

This will print a tuple containing information about the machine’s architecture and the bitness of the Python interpreter, like this:

('64bit', 'WindowsPE')

The first value of the tuple indicates the bitness of the Python interpreter, either '32bit' or '64bit'. If you see '64bit', it means your Python installation is 64-bit. If you see '32bit', it means your Python installation is 32-bit.

Alternatively, you can also check the file name of the Python executable. On Windows, the 32-bit version of Python has an executable named python.exe, while the 64-bit version has an executable named python.exe and a separate executable named pythonw.exe. On macOS and Linux, the 32-bit version of Python is less common, and the 64-bit version is typically installed by default. You can check the file name of the Python executable by running the following command in the terminal:

which python

This will print the full path to the Python executable, which typically ends with either python or python3. If the file name contains x86, it means the installation is 32-bit, and if it contains x86_64 or amd64, it means the installation is 64-bit.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply