环境
osx version:10.11.5
python version:2.7.10
我编译一个 c 文件:
gcc -fPIC test.c -shared -lpython2.7 -L /usr/lib/python2.7/ -I /usr/include/python2.7/ -o test.so
然后我得到了一个 test.so
如果在系统环境下的 python 执行 import test 是没有问题的。
但是如果在 python 虚拟环境下(pyenv , python 版本是一样的), import test 就会报错
Fatal Python error: PyThreadState_Get: no current thread
[1] 97703 abort python
osx version:10.11.5
python version:2.7.10
我编译一个 c 文件:
gcc -fPIC test.c -shared -lpython2.7 -L /usr/lib/python2.7/ -I /usr/include/python2.7/ -o test.so
然后我得到了一个 test.so
如果在系统环境下的 python 执行 import test 是没有问题的。
但是如果在 python 虚拟环境下(pyenv , python 版本是一样的), import test 就会报错
Fatal Python error: PyThreadState_Get: no current thread
[1] 97703 abort python