Created
August 4, 2011 07:30
-
-
Save saghul/1124655 to your computer and use it in GitHub Desktop.
Check Python architecture reliably
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://mail.python.org/pipermail/pythonmac-sig/2009-September/021649.html | |
# On Mac OSX Python may run in 32 or 64 bit mode so platform.architecture() is not reliable. | |
# Example: use 32bit Python: export VERSIONER_PYTHON_PREFER_32_BIT=yes | |
def arch(): | |
import ctypes | |
return {4: "i386", 8: "x86_64"}[ctypes.sizeof(ctypes.c_size_t)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment