Question

When I build a c extension using python setup.py build, the result is created under a directory named

build/lib.linux-x86_64-2.6/

where the part after lib. changes by the OS, CPU and Python version.

Is there a way I can access the appropriate string for my current architecture from python? Hopefully in a way that is guaranteed to match what distutils is creating.

Was it helpful?

Solution

>>> from distutils import util
>>> util.get_platform()
'linux-x86_64'

>>> import sys
>>> '%s.%s' % sys.version_info[:2]
2.6
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top