diff --git a/Base/QTCore/qSlicerCoreApplication.cxx b/Base/QTCore/qSlicerCoreApplication.cxx index 00c6a4bdf1d8db742dc0d79f3b28dcf1dd1a3a6b..e7ac24975d7d516047d855842bbf220fc1e2b09a 100644 --- a/Base/QTCore/qSlicerCoreApplication.cxx +++ b/Base/QTCore/qSlicerCoreApplication.cxx @@ -902,7 +902,12 @@ void qSlicerCoreApplication::handleCommandLineArguments() // Set 'sys.executable' so that Slicer can be used as a "regular" python interpreter this->corePythonManager()->executeString( - QString("import sys; sys.executable = '%1'; del sys").arg(this->applicationFilePath())); + #if (QT_VERSION > QT_VERSION_CHECK(5, 0, 0)) + QString("import sys; sys.executable = '%1'; del sys").arg(QStandardPaths::findExecutable("PythonSlicer")) + #else + QString("import sys, distutils.spawn; sys.executable = distutils.spawn.find_executable('PythonSlicer'); del sys, distutils") + #endif + ); // Clean memory for(int i = 0; i < pythonArgc; ++i){ delete[] pythonArgv[i];}