How to check if Python version is 32-bit or 64-bit.
Pyhton version
We all know how to check the Python version. Just input python –version at the command line and, depending on your OS, you’ll see an output like this:
C:\Users\M>python --version
Python 3.7.7
C:\Users\M>
But the version keyword does not show the 32-bit or 64-bit version of your python. On stackoverflow they suggest using platform.architecture, but it does not work on my windows machine. So you can use two different approaches.
Python 32-bit or 64-bit
The first approach is using struct.calcsize(). Use it from the idle, as follows:
# It returns "32" for 32-bit and "64" for 64-bit
>>> import struct
>>> print(struct.calcsize("P")*8)
32
With the second approach (works for win10 systems) you don’t even need to run the idle. Just type python in the win10 app-search box and you’ll see python versions installed on your machine, straight in the results menu:

Be sure to use the “struct” approach when using virtual environments like venv or virtualenvs.