For a script I am making, I need a cross-platform way to check:
- If java is installed.
- What platform the script is running on (eg windows/amd64 or linux/x86)
in python. How could I do both of these.
Edit: The platform module is perfect for number 2, but a way to see just if java is installed not the version would be preferred.
is a duplicate of How to determine whether java is installed on a system through python? for which I agree with the second answer, in particular, that you shouldn’t check most likely. You should document your dependency on it, and have your package manager on whatever systems have one install it, and on Windows have your user install it themselves.
The platform module.