Pythonでヘッダーのinclude pathを取得する方法 ( How to print include path of Python FIles ? )

MakefileでPythonのファイルパスを取得したいときなどがたまにあるだろう。 そんなときはsys.prefixのトリックが便利だ. import sys print(sys.prefix) #/usr/local/Cellar/python/2.7.xx/Frameworks/Python.framework/Versions/2.7 etc ... MakefileでPython のインクルードパス*1を取得するときは PYTHON_PREFIX = $(she…