Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

where to find the <Python.h> #3

Closed
yuxiaoba opened this issue Nov 17, 2018 · 4 comments
Closed

where to find the <Python.h> #3

yuxiaoba opened this issue Nov 17, 2018 · 4 comments

Comments

@yuxiaoba
Copy link

# github.com/tsavola/go-python
C:\gopath\src\github.com\tsavola\go-python\python.go:9:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
          ^~~~~~~~~~
@tsavola
Copy link
Owner

tsavola commented Nov 17, 2018

It's supplied by Python. I don't know how you can get it on Windows, but on Linux you need to install a package like "libpython-dev" or such.

@yuxiaoba
Copy link
Author

yuxiaoba commented Nov 18, 2018

Thank you for your reply!
Now I use it on Linux
And I have install such package

root@ubuntu:~# aptitude install python-dev 
python-dev is already installed at the requested version (2.7.12-1~16.04)
python-dev is already installed at the requested version (2.7.12-1~16.04)
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 368 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
                                         
root@ubuntu:~# aptitude install libpython-dev 
libpython-dev is already installed at the requested version (2.7.12-1~16.04)
libpython-dev is already installed at the requested version (2.7.12-1~16.04)
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 368 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

But when I run the example ,it performs errors like below

go build github.com/tsavola/go-python: build constraints exclude all Go files in /opt/go/src/github.com/tsavola/go-python

And my go environment is

root@ubuntu:/usr/local/go/src# go env
GOARCH="386"
GOBIN="/usr/local/go/bin/"
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
GO386="sse2"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build387092920=/tmp/go-build -gno-record-gcc-switches"

How could I solve it ?

@tsavola
Copy link
Owner

tsavola commented Nov 18, 2018

Sounds like this: golang/go#24068

I see you have CGO_ENABLED=0, but go-python is based on cgo.

@yuxiaoba
Copy link
Author

Thank you very much .I have solved it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants