@@ -37,6 +37,9 @@ func GetPythonRoot(projectPath string) string {
3737
3838// GetPythonBinDir returns the Python binary directory path relative to project path
3939func GetPythonBinDir (projectPath string ) string {
40+ if runtime .GOOS == "windows" {
41+ return filepath .Join (GetPythonRoot (projectPath ))
42+ }
4043 return filepath .Join (GetPythonRoot (projectPath ), "bin" )
4144}
4245
@@ -93,6 +96,7 @@ func SetBuildEnv(projectPath string) {
9396 }
9497 path := os .Getenv ("PATH" )
9598 path = GetGoBinDir (absPath ) + pathSeparator () + path
99+ path = GetPythonBinDir (absPath ) + pathSeparator () + path
96100 if runtime .GOOS == "windows" {
97101 path = GetMingwRoot (absPath ) + pathSeparator () + path
98102 path = GetTinyPkgConfigDir (absPath ) + pathSeparator () + path
@@ -101,6 +105,8 @@ func SetBuildEnv(projectPath string) {
101105 os .Setenv ("GOPATH" , GetGoPath (absPath ))
102106 os .Setenv ("GOROOT" , GetGoRoot (absPath ))
103107 os .Setenv ("GOCACHE" , GetGoCacheDir (absPath ))
108+ os .Setenv ("PKG_CONFIG_PATH" , GetPythonPkgConfigDir (absPath ))
109+ os .Setenv ("CGO_ENABLED" , "1" )
104110}
105111
106112func pathSeparator () string {
@@ -110,13 +116,13 @@ func pathSeparator() string {
110116 return ":"
111117}
112118
113- // WriteEnvFile writes environment variables to .python /env.txt
119+ // WriteEnvFile writes environment variables to .deps /env.txt
114120func WriteEnvFile (projectPath , pythonHome , pythonPath string ) error {
115121 // Prepare environment variables
116122 envVars := []string {
117- fmt .Sprintf ("PKG_CONFIG_PATH=%s" , filepath .Join (pythonHome , "lib" , "pkgconfig" )),
118123 fmt .Sprintf ("PYTHONPATH=%s" , strings .TrimSpace (pythonPath )),
119124 fmt .Sprintf ("PYTHONHOME=%s" , pythonHome ),
125+ fmt .Sprintf ("PATH=%s" , GetPythonBinDir (projectPath )),
120126 }
121127
122128 // Write to env.txt
0 commit comments