When I start the Python interpreter in command line mode I get a message saying which compiler was used for building it. Is there a way to get this information in Python ? I know I could start the interpreter with subprocess.Popen and parse the output, but I'm looking for an easier and more elegant method.
The background is that I want to build Python extensions for a CMake based C++ framework, and I would like to write a CMake macro wich checks if the correct compiler is installed.
Use platform.python_compiler().
You can use the sys.version variable to access this information:
>>> sys.version
'2.7.2 (default, Jun 29 2011, 11:17:09) \n[GCC 4.6.1]'
It will tell you which compiler was used to compile Python, but it won't ensure the mentioned compiler is installed on the system (this could be a pre-built Python version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With