DEV Community

Discussion on: Extending Python with Go

Collapse
 
unacceptable profile image
Robert J.

I tried following this example for python 3.9.1 instead of 3.8.1.

For some reason when I do a go build I get an error that it's trying to use 3.8 even though I set the variables (PKG_CONFIG_PATH & LIBRARY_PATH) to 3.9. I am utterly confused by this. Any ideas what I am doing wrong here?

Collapse
 
unacceptable profile image
Robert J.

Never mind I sorted it out. I mentally ad-blocked comments when I was reading the code and missed the following:

// #cgo LDFLAGS: -L/Library/Frameworks/Python.framework/Versions/3.8/lib -lpython3.8 -ldl -framework CoreFoundation
Enter fullscreen mode Exit fullscreen mode

I changed it to

// #cgo LDFLAGS: -L/Library/Frameworks/Python.framework/Versions/3.9/lib -lpython3.9 -ldl -framework CoreFoundation
Enter fullscreen mode Exit fullscreen mode

and was able to build it in python 3.9.

Fantastic tutorial! Thanks for sharing!

Collapse
 
astagi profile image
Andrea Stagi

Thanks 😊