我开始是在windows环境下直接go get github.com/sbinet/go-python
会报错pkg-config: exec: “pkg-config”: executable file not found in %PATH%
后来还是算了,直接在我的云服务器上面去跑了,windows系统的坑略多,于是放弃windows,直接去了linux系统进行如下操作:
官方文档写的是
If go get + pkg-config failed:
$ cd go-python
$ edit cgoflags.go
$make VERBOSE=1
Note: you’ll need the proper header and python
development environment. On Debian, you’ll need to install the
python-all-dev package
最后总结报这个错是/usr/lib/pkgconfig少了python-2.7.pc文件以及python-dev环境
在/usr/lib/pkgconfig新建python-2.7.pc:
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include
Name: Python
Description: Python library
Requires:
Version: 2.7
Libs.private: -lpthread -ldl -lutil
Libs: -L${libdir} -lpython2.7
Cflags: -I${includedir}/python2.7
直接下载python-dev会有依赖关系的问题,要通过aptitude来下载
sudo apt-get install aptitude
sudo aptitude install py