Yes, but it is possible (I am not sure whether python will write version information to the registry when installing) that it cannot be obtained, because many people have encountered this problem of failing to obtain the python version through the registry when installing software Of course, you can also execute commands upstairs or through pipelines to obtain python information, but there is a requirement. The python you want to query must be set in the PATH environment variable
A tricky way is to execute the system command in c++, and then read the python version information from the
out.txt
file:out.txt
文件里去读python版本信息:system("python --version 2> out.txt");
system("python --version 2> out.txt");
🎜Yes, but it is possible (I am not sure whether python will write version information to the registry when installing) that it cannot be obtained, because many people have encountered this problem of failing to obtain the python version through the registry when installing software
Of course, you can also execute commands upstairs or through pipelines to obtain python information, but there is a requirement. The python you want to query must be set in the PATH environment variable