SOLVED!
It took a while to sort out the various locations.
Environment Variables:
export LIBRARY_PATH=/usr/local/Frameworks/Python.framework/Versions/3.9/lib
export
PKG_CONFIG_PATH=/usr/local/Frameworks/Python.framework/Versions/3.9/lib/pkgconfig
Code:
...
package main
/*
#cgo
Doh! I forgot the include. I get a linker error now:
...
package main
/*
#cgo pkg-config: python3
#cgo LDFLAGS: -lpython3.8
#include
*/
import "C"
import (
"fmt"
)
func main() {
C.Py_Initialize()
fmt.Println(C.GoString(C.Py_GetVersion()))
C.Py_Finalize()
}
...
$ go run .
# producer