简体   繁体   中英

Check if the given String points to a Python installation in Java

Is there any way I can check in Java if the String I'm receiving points to a valid Python installation directory?

The idea is to force the user to only give a valid path to his Python installation folder, and if the path is not valid, return an error to let them know.

This solution has a couple of problems. On *nix machines, there is not really such a thing as a installation directory.

So, instead of a directory, you might want the use to select an executable. This will also allow you to run a python --version to check if the version is ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM