- // python 3 not found let us look for python 2
- if (command.empty())
- command = python23("python2");
-
- // python2 does not exists, let us try python2.x
- if (command.empty()) {
- // It was not, so check whether we can find it elsewhere in
- // PATH, maybe with some suffix appended.
- 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("python2*"));
- for (int i = 0; i < list.size() && command.empty(); ++i) {
- string const binary = addName(localdir,
- list.at(i).toLocal8Bit().constData());
- command = python23(binary, true);
- }
- }