+#ifndef _WIN32
+ // python3 does not exists, let us try to find python3.x in PATH
+ // the search is probably broader than required
+ // but we are trying hard to find a valid python binary
+ vector<string> const path = getEnvPath("PATH");
+ lyxerr << "Looking for python 3.x ...\n";
+ for (auto bin : path) {
+ QString const dir = toqstr(bin);
+ string const localdir = dir.toLocal8Bit().constData();
+ QDir qdir(dir);
+ qdir.setFilter(QDir::Files | QDir::Executable);
+ QStringList list = qdir.entryList(QStringList("python3*"));
+ for (auto bin2 : list) {
+ string const binary = "\"" + addName(localdir,
+ bin2.toLocal8Bit().constData()) + "\"";
+ command = python23_call(binary, true);
+ if (!command.empty())
+ return command;
+ }
+ }
+#endif // !_WIN32
+