错误:“PyThreadState”{aka“struct _ts”}没有名为“exc_type”的成员;您的意思是“curexc_type”吗?构建 Cython 扩展时

Mon*_*lal 8 c++ python linux struct cython

我在 Python 3.8 中收到以下错误,而在 Python 3.6 中则没有收到该错误。我怎样才能让它与Python 3.8一起工作?为了重现该错误,请按照此处操作: https: //github.com/davidstutz/mesh-fusion/issues/7

\n
[3645:3637 0:2090] 11:04:08 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu\n$ python setup.py build_ext --inplace\nAdded OpenMP\nrunning build_ext\nskipping \'cyfusion.cpp\' Cython extension (up-to-date)\nbuilding \'cyfusion\' extension\nx86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include -I/home/mona/venv/tsdf/include -I/usr/include/python3.8 -c cyfusion.cpp -o build/temp.linux-x86_64-3.8/cyfusion.o -ffast-math -msse -msse2 -msse3 -msse4.2 -fopenmp\nIn file included from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,\n                 from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from cyfusion.cpp:531:\n/home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]\n   17 | #warning "Using deprecated NumPy API, disable it with " \\\n      |  ^~~~~~~\ncyfusion.cpp: In function \xe2\x80\x98PyObject* PyInit_cyfusion()\xe2\x80\x99:\ncyfusion.cpp:22866:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22866 |   __pyx_type_8cyfusion_PyViews.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22866:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22866 |   __pyx_type_8cyfusion_PyViews.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22866:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22866 |   __pyx_type_8cyfusion_PyViews.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22871:33: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22871 |   __pyx_type_8cyfusion_PyVolume.tp_print = 0;\n      |                                 ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22871:33: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22871 |   __pyx_type_8cyfusion_PyVolume.tp_print = 0;\n      |                                 ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22871:33: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22871 |   __pyx_type_8cyfusion_PyVolume.tp_print = 0;\n      |                                 ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22878:26: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22878 |   __pyx_type___pyx_array.tp_print = 0;\n      |                          ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22878:26: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22878 |   __pyx_type___pyx_array.tp_print = 0;\n      |                          ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22878:26: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22878 |   __pyx_type___pyx_array.tp_print = 0;\n      |                          ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22883:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22883 |   __pyx_type___pyx_MemviewEnum.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22883:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22883 |   __pyx_type___pyx_MemviewEnum.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22883:32: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22883 |   __pyx_type___pyx_MemviewEnum.tp_print = 0;\n      |                                ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22895:31: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22895 |   __pyx_type___pyx_memoryview.tp_print = 0;\n      |                               ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22895:31: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22895 |   __pyx_type___pyx_memoryview.tp_print = 0;\n      |                               ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22895:31: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22895 |   __pyx_type___pyx_memoryview.tp_print = 0;\n      |                               ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22905:36: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22905 |   __pyx_type___pyx_memoryviewslice.tp_print = 0;\n      |                                    ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22905:36: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22905 |   __pyx_type___pyx_memoryviewslice.tp_print = 0;\n      |                                    ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp:22905:36: warning: \xe2\x80\x98_typeobject::tp_print\xe2\x80\x99 is deprecated [-Wdeprecated-declarations]\n22905 |   __pyx_type___pyx_memoryviewslice.tp_print = 0;\n      |                                    ^~~~~~~~\nIn file included from /usr/include/python3.8/object.h:746,\n                 from /usr/include/python3.8/pytime.h:6,\n                 from /usr/include/python3.8/Python.h:85,\n                 from cyfusion.cpp:4:\n/usr/include/python3.8/cpython/object.h:260:30: note: declared here\n  260 |     Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);\n      |                              ^~~~~~~~\ncyfusion.cpp: In function \xe2\x80\x98void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)\xe2\x80\x99:\ncyfusion.cpp:24028:21: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24028 |     *type = tstate->exc_type;\n      |                     ^~~~~~~~\n      |                     curexc_type\ncyfusion.cpp:24029:22: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24029 |     *value = tstate->exc_value;\n      |                      ^~~~~~~~~\n      |                      curexc_value\ncyfusion.cpp:24030:19: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24030 |     *tb = tstate->exc_traceback;\n      |                   ^~~~~~~~~~~~~\n      |                   curexc_traceback\ncyfusion.cpp: In function \xe2\x80\x98void __Pyx__ExceptionReset(PyThreadState*, PyObject*, PyObject*, PyObject*)\xe2\x80\x99:\ncyfusion.cpp:24037:24: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24037 |     tmp_type = tstate->exc_type;\n      |                        ^~~~~~~~\n      |                        curexc_type\ncyfusion.cpp:24038:25: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24038 |     tmp_value = tstate->exc_value;\n      |                         ^~~~~~~~~\n      |                         curexc_value\ncyfusion.cpp:24039:22: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24039 |     tmp_tb = tstate->exc_traceback;\n      |                      ^~~~~~~~~~~~~\n      |                      curexc_traceback\ncyfusion.cpp:24040:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24040 |     tstate->exc_type = type;\n      |             ^~~~~~~~\n      |             curexc_type\ncyfusion.cpp:24041:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24041 |     tstate->exc_value = value;\n      |             ^~~~~~~~~\n      |             curexc_value\ncyfusion.cpp:24042:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24042 |     tstate->exc_traceback = tb;\n      |             ^~~~~~~~~~~~~\n      |             curexc_traceback\ncyfusion.cpp: In function \xe2\x80\x98int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)\xe2\x80\x99:\ncyfusion.cpp:24112:24: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24112 |     tmp_type = tstate->exc_type;\n      |                        ^~~~~~~~\n      |                        curexc_type\ncyfusion.cpp:24113:25: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24113 |     tmp_value = tstate->exc_value;\n      |                         ^~~~~~~~~\n      |                         curexc_value\ncyfusion.cpp:24114:22: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24114 |     tmp_tb = tstate->exc_traceback;\n      |                      ^~~~~~~~~~~~~\n      |                      curexc_traceback\ncyfusion.cpp:24115:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24115 |     tstate->exc_type = local_type;\n      |             ^~~~~~~~\n      |             curexc_type\ncyfusion.cpp:24116:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24116 |     tstate->exc_value = local_value;\n      |             ^~~~~~~~~\n      |             curexc_value\ncyfusion.cpp:24117:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24117 |     tstate->exc_traceback = local_tb;\n      |             ^~~~~~~~~~~~~\n      |             curexc_traceback\ncyfusion.cpp: In function \xe2\x80\x98void __Pyx__ExceptionSwap(PyThreadState*, PyObject**, PyObject**, PyObject**)\xe2\x80\x99:\ncyfusion.cpp:24354:24: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x80\x98curexc_type\xe2\x80\x99?\n24354 |     tmp_type = tstate->exc_type;\n      |                        ^~~~~~~~\n      |                        curexc_type\ncyfusion.cpp:24355:25: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_value\xe2\x80\x99; did you mean \xe2\x80\x98curexc_value\xe2\x80\x99?\n24355 |     tmp_value = tstate->exc_value;\n      |                         ^~~~~~~~~\n      |                         curexc_value\ncyfusion.cpp:24356:22: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_traceback\xe2\x80\x99; did you mean \xe2\x80\x98curexc_traceback\xe2\x80\x99?\n24356 |     tmp_tb = tstate->exc_traceback;\n      |                      ^~~~~~~~~~~~~\n      |                      curexc_traceback\ncyfusion.cpp:24357:13: error: \xe2\x80\x98PyThreadState\xe2\x80\x99 {aka \xe2\x80\x98struct _ts\xe2\x80\x99} has no member named \xe2\x80\x98exc_type\xe2\x80\x99; did you mean \xe2\x8

ead*_*ead 4

-f使用(或)强制重建/重新生成 cythonized 文件--force,即:

\n
python setup.py build_ext -i -f\n
Run Code Online (Sandbox Code Playgroud)\n

或者如果使用pip

\n
pip install --global-option build --global-option --force .\n
Run Code Online (Sandbox Code Playgroud)\n

可以粗略地解释为:在安装运行build(包括build_ext)之前使用选项 \xc2\xb4--force`。

\n
\n

目前的问题是,Cython 生成的 c/cpp 文件将来可能与新的 Python 版本不兼容。

\n

一个例子是,Cython 0.27 不支持 Python3.8,因为当时 Python3.8 还不存在。因此,使用 Cython 0.27 创建的 c/cpp 文件(例如cyfusion.cpp来自 git-repository)将无法使用 Py3.8+-headers 构建。

\n

distutils使用时间戳来决定文件是否应该重建/重新生成/回收,就其而言,Cython 生成的cyfusion.cpp文件是最新的 - 因为cyfusion.pyx在生成后没有更改。根本没有考虑整个不同的 Python/Cython 版本业务。

\n

因此,强制 distutils 重建所有内容可以解决过时的 c/cpp 文件的问题。

\n

一般来说,我认为将 cython 生成的文件放入 distribution/git 中不是一个好主意,因为它可能/将成为将来的绊脚石,有一些这样的例子:

\n
    \n
  • “\xe2\x80\x9ctp_print 不是 _typeobject\xe2\x80\x9d”的成员 - Python3.9+ 的错误(例如这篇文章
  • \n
  • 旧的 cython 版本没有属性__reduce_cython__(例如这篇文章
  • \n
\n
\n

另一个可能的修复方法是从 distribution/git-repository 中删除过时的(cython 生成的)cyfusion.cpp文件并运行

\n
python setup.py build_ext -i\n
Run Code Online (Sandbox Code Playgroud)\n

然后。

\n