Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i need to know the gcc compiler version in python script.

How can i get gcc compiler version in python script on Linux?

share|improve this question
Get the output of gcc --version – Blender yesterday
subprocess.check_output. Read the doc to see how to use it. – zhangyangyu yesterday
Use : docs.python.org/2/library/subprocess.html#module-subprocess to get the output of gcc --version – p1rox yesterday

put on hold as off-topic by Mitch Wheat, Haidro, David Cain, djf, talonmies yesterday

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist" – Mitch Wheat, Haidro, David Cain, talonmies
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

If gcc is in your path, you can use this:

import subprocess
gcc_version = subprocess.check_output(["gcc", "--version"])
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.