Reputation: 343
I was checking what version of Python Shell I'm using (32 or 64 bit).
When I run
>>> import platform
>>> print(platform.architecture())
I get:
('64bit', 'WindowsPE')
BUT
If I run
>>> import sys
>>> sys.platform
I get:
'win32'
Can somebody explain this to me?
Did I do something wrong during the installation?
Upvotes: 0
Views: 164
Reputation: 117981
The docs clear this up well
Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple (bits, linkage) which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size.
The function relies on the system’s file command to do the actual work. This is available on most if not all Unix platforms and some non-Unix platforms and then only if the executable points to the Python interpreter. Reasonable defaults are used when the above needs are not met.
This string contains a platform identifier that can be used to append platform-specific components to sys.path, for instance.
For Unix systems, except on Linux and AIX, this is the lowercased OS name as returned by uname -s with the first part of the version as returned by uname -r appended, e.g. 'sunos5' or 'freebsd8', at the time when Python was built. Unless you want to test for a specific system version, it is therefore recommended to use the following idiom:
For other systems, the values are:
- AIX -
'aix'
- Linux -
'linux'
- Windows -
'win32'
- Windows/Cygwin -
'cygwin'
- macOS -
'darwin'
Upvotes: 2