I am hitting the below error when I try compiling the go code from Windows (using msys terminal). (I have used go-python from sbinet for one of my use case which needed python from GO.)
# github.com/sbinet/go-python
In file included from C:\Users\BHARATU\go\pkg\mod\github.com\sbinet\go-python@v0.1.0\capi.go:3:
./go-python.h:4:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
I have set the --cflags
for the gcc too.
$ python
Python 3.8.5 (default, Aug 27 2020, 21:53:06)
[GCC 9.3.0] on msys
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ which python
/usr/bin/python
$ /usr/bin/pkg-config.exe --cflags --libs python
-I/usr/include/python3.8 -lcrypt -lintl -ldl -lpython3.8
The below command fails:
$ gcc -Wall -I/usr/include/python3.8 -lpython3.8 utilsmodule.c -o Utilc
gcc.exe: error: utilsmodule.c: No such file or directory
ReadMe.Md
in https://github.com/sbinet/go-python says to change the cgoflags
based on the OS type.
Below is the default snapshot from my env. What do I need to change here?
// +build windows
package python
// #cgo 386 CFLAGS: -I C:/Python27/include
// #cgo amd64 CFLAGS: -I C:/Python27-x64/include
// #cgo amd64 CFLAGS: -D MS_WIN64
// #cgo 386 LDFLAGS: -L C:/Python27/libs -lpython27
// #cgo amd64 LDFLAGS: -L C:/Python27-x64/libs -lpython27
//
// #include "go-python.h"
import "C"