Skip to content

Instantly share code, notes, and snippets.

@saghul
Created August 4, 2011 07:30
Show Gist options
  • Save saghul/1124655 to your computer and use it in GitHub Desktop.
Save saghul/1124655 to your computer and use it in GitHub Desktop.
Check Python architecture reliably
# 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