How to get the arch string that distutils uses to build?

When I create the extension c with python setup.py build, the result is created in a directory named

build/lib.linux-x86_64-2.6/

where the part after is lib.changed using the OS, CPU and Python version.

Is there a way to access the appropriate line for the current architecture from python? Hopefully in a way that is guaranteed to match what distutils creates.

+3
source share
1 answer
>>> from distutils import util
>>> util.get_platform()
'linux-x86_64'

>>> import sys
>>> '%s.%s' % sys.version_info[:2]
2.6
+3
source

Source: https://habr.com/ru/post/1723980/


All Articles