Append python Scripts directory to PATH env on windows

This commit is contained in:
Marek Roszko 2025-06-05 23:12:32 -04:00
parent ba63b07a5e
commit fe54a2ec0f
2 changed files with 14 additions and 1 deletions

View File

@ -136,7 +136,7 @@ wxString PATHS::GetDefault3rdPartyPath()
tmp.AppendDir( wxT( "3rdparty" ) );
return tmp.GetPath();
return tmp.GetAbsolutePath();
}

View File

@ -249,6 +249,19 @@ bool SCRIPTING::scriptingSetup()
// Now initialize Python Home via capi
Py_SetPythonHome( pyHome.GetFullPath().c_str() );
}
// Allow executing the python pip installed scripts on windows easily
wxString envPath;
if( wxGetEnv( wxT( "PATH" ), &envPath ) )
{
wxFileName pythonThirdPartyBin( PATHS::GetDefault3rdPartyPath() );
pythonThirdPartyBin.AppendDir( wxString::Format( wxT( "Python%d%d" ), PY_MAJOR_VERSION, PY_MINOR_VERSION ) );
pythonThirdPartyBin.AppendDir( wxT( "Scripts" ) );
envPath = pythonThirdPartyBin.GetAbsolutePath() + ";" + envPath;
wxSetEnv( wxT( "PATH" ), envPath );
}
#else
// Intended for msys2 but we could probably use the msvc equivalent code too
// If our python.exe (in kicad/bin) exists, force our kicad python environment