go-python/cpy3

installation problem

RobinxiangbinNie opened this issue · 5 comments

Describe what happened:
When trying to install the package by: go get github.com/go-python/cpy3
It failed and complain like this:
../../../../go/pkg/mod/github.com/go-python/cpy3@v0.0.0-20211127141159-9ab339a58efd/thread.go:53:2: could not determine kind of name for C.PyEval_ReInitThreads

Describe what you expected:
I am expected to install it locally just simple like other packages.

Steps to reproduce the issue:
Only one step by run command line: go get github.com/go-python/cpy3

1oid commented

you can run:

# set your PKG_CONFIG_PATH env point your python pkgconfig.
export PKG_CONFIG_PATH=/Users/xxx/opt/anaconda3/envs/py37/lib/pkgconfig/
# run your command line
go get github.com/go-python/cpy3

@RobinxiangbinNie what OS are you using?

@RobinxiangbinNie what OS are you using?

I am using Ubuntu 20.04. And I am now thinking maybe this was caused by my python version as I need to use Python 3.9 in my project because another package.

yes, that sounds like it. You need Python 3.7.
Here’s an example for Debian 9, it should work similarly on Ubuntu:

https://github.com/christian-korneck/Dockerfiles/blob/master/debian-go-python3-demo/Dockerfile.debian9

Does this solve your problem?

144mb commented

an alternative would be to install Python 3.7 on Ubuntu 20.04 from the Deadsnakes PPA repo (which provides older/newer Python versions for Ubuntu)

https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa