I want to use C ++ to confirm local windows system python version installed, I do not know How to determine?
-
1What do you want to happen in the event that multiple python versions are installed?Paul– Paul2016-04-22 02:08:07 +00:00Commented Apr 22, 2016 at 2:08
-
Thanks for attention, if I can get them all, that will be best.overflow– overflow2016-04-22 03:10:19 +00:00Commented Apr 22, 2016 at 3:10
Add a comment
|
1 Answer
If the python directory has been added to the PATH environment variable, you can easily _popen python with the --version argument, and parse out the version number from the standard output (which will be e.g. Python 2.7.6).
Another option would be to use regedit to see if the version appears somewhere in the registry that you can read it from. Lots of existing S.O. Q&A on how to read registry values....
If you get stuck implementing either option, post your code and the specific problem.