报错如下:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/pyln/37_env/include -I/usr/python-3-7-2/include/python3.7m -c thriftpy/transport/cybase.c -o build/temp.linux-x86_64-3.7/thriftpy/transport/cybase.o
thriftpy/transport/cybase.c: In function ‘__Pyx__GetException’:
thriftpy/transport/cybase.c:3127:22: error: ‘PyThreadState’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
thriftpy/transport/cybase.c:3128:23: error: ‘PyThreadState’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
thriftpy/transport/cybase.c:3129:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
thriftpy/transport/cybase.c:3130:11: error: ‘PyThreadState’ has no member named ‘exc_type’
tstate->exc_type = local_type;
^
thriftpy/transport/cybase.c:3131:11: error: ‘PyThreadState’ has no member named ‘exc_value’
tstate->exc_value = local_value;
^
thriftpy/transport/cybase.c:3132:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tstate->exc_traceback = local_tb;
^
thriftpy/transport/cybase.c: In function ‘__Pyx__ExceptionSwap’:
thriftpy/transport/cybase.c:3154:22: error: ‘PyThreadState’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
thriftpy/transport/cybase.c:3155:23: error: ‘PyThreadState’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
thriftpy/transport/cybase.c:3156:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
thriftpy/transport/cybase.c:3157:11: error: ‘PyThreadState’ has no member named ‘exc_type’
tstate->exc_type = *type;
^
thriftpy/transport/cybase.c:3158:11: error: ‘PyThreadState’ has no member named ‘exc_value’
tstate->exc_value = *value;
^
thriftpy/transport/cybase.c:3159:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tstate->exc_traceback = *tb;
^
thriftpy/transport/cybase.c: In function ‘__Pyx__ExceptionSave’:
thriftpy/transport/cybase.c:3178:19: error: ‘PyThreadState’ has no member named ‘exc_type’
*type = tstate->exc_type;
^
thriftpy/transport/cybase.c:3179:20: error: ‘PyThreadState’ has no member named ‘exc_value’
*value = tstate->exc_value;
^
thriftpy/transport/cybase.c:3180:17: error: ‘PyThreadState’ has no member named ‘exc_traceback’
*tb = tstate->exc_traceback;
^
thriftpy/transport/cybase.c: In function ‘__Pyx__ExceptionReset’:
thriftpy/transport/cybase.c:3187:22: error: ‘PyThreadState’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
thriftpy/transport/cybase.c:3188:23: error: ‘PyThreadState’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
thriftpy/transport/cybase.c:3189:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
thriftpy/transport/cybase.c:3190:11: error: ‘PyThreadState’ has no member named ‘exc_type’
tstate->exc_type = type;
^
thriftpy/transport/cybase.c:3191:11: error: ‘PyThreadState’ has no member named ‘exc_value’
tstate->exc_value = value;
^
thriftpy/transport/cybase.c:3192:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’
tstate->exc_traceback = tb;
^
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/pyln/37_env/bin/python37 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-wr1oejp7/thriftpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mgvsc414/install-record.txt --single-version-externally-managed --compile --install-headers /home/pyln/37_env/include/site/python3.7/thriftpy" failed with error code 1 in /tmp/pip-install-wr1oejp7/thriftpy/
有是非常常见的 command 'gcc' failed with exit status 1 错误,但是却不是缺少Python.h,核心错误在于‘PyThreadState’ has no member named ‘xxxxxx’,于是在网上寻找和尝试了好久之后,终于解决,解决方法如下:
解决办法
pip install cython