MinGW: if PYTHONHOME is not set then automatically do it at program start

This commit is contained in:
wmayer
2021-09-23 12:34:09 +02:00
parent b89a7dc88c
commit f38481a68c
2 changed files with 12 additions and 0 deletions

View File

@@ -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