diff --git a/src/Main/MainCmd.cpp b/src/Main/MainCmd.cpp index 4a11233ab5..fa230acacc 100644 --- a/src/Main/MainCmd.cpp +++ b/src/Main/MainCmd.cpp @@ -72,6 +72,13 @@ int main( int argc, char ** argv ) setlocale(LC_ALL, ""); setlocale(LC_NUMERIC, "C"); +#if defined(__MINGW32__) + const char* mingw_prefix = getenv("MINGW_PREFIX"); + const char* py_home = getenv("PYTHONHOME"); + if (!py_home && mingw_prefix) + _putenv_s("PYTHONHOME", mingw_prefix); +#endif + // Name and Version of the Application App::Application::Config()["ExeName"] = "FreeCAD"; App::Application::Config()["ExeVendor"] = "FreeCAD"; diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 93c263d85e..af31924450 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -127,6 +127,11 @@ int main( int argc, char ** argv ) #elif defined(FC_OS_MACOSX) (void)QLocale::system(); putenv("PYTHONPATH="); +#elif defined(__MINGW32__) + const char* mingw_prefix = getenv("MINGW_PREFIX"); + const char* py_home = getenv("PYTHONHOME"); + if (!py_home && mingw_prefix) + _putenv_s("PYTHONHOME", mingw_prefix); #else _putenv("PYTHONPATH="); // https://forum.freecadweb.org/viewtopic.php?f=4&t=18288