How to check if python is installed in windows from java?

How can I check inside a java program if python is installed on windows? Python does not add its path to the system Path, and one should not make assumptions about the likely installation path (i.e., it can be installed anywhere).

+3
source share
5 answers

Use the Java Runtime to execute the following python --version command.

If this works, you have Python and the standard output is the version number.

If this does not work, you do not have Python.

+2
source

Python Windows. , , , , .

+2

, , ?

software\python\pythoncore

() python, MSI-, MsiEnumProducts Function, , python.

+1

exec ( String)          . , Python

0

  • Process process = Runtime.getRuntime(). exec ("cmd/c C:\Python27\python --version ");
-2

Source: https://habr.com/ru/post/1715508/


All Articles