我的公司正在从Python2.7迁移到Python3.6,我正在尝试安装cgpyencode。但这根本不起作用,我得到了错误
gpolyencode_py.cpp:187:69: error: ‘Py_InitModule3’ was not declared in this scope
"Google Maps Polyline encoding (C extension)");
^
gpolyencode_py.cpp:190:9: error: return-statement with no value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
return;
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
每次。一些快速的谷歌搜索似乎表明模块本身需要重写,而我没有资格这样做。我已经尝试过安装python3.6-dev
libxml2-dev
等基础知识,但问题仍然存在。有没有一种解决方法或方法可以在不重建的情况下安装它?在
python2和python3之间的C扩展是非常不同的。但是,您可以使用预处理器编写一个同时满足这两个条件的文件。下面是一个非常基本的C模块from my github:
注意,
#else
分支可能与当前模块的类似,您需要更新它,使其看起来更像#if PY_MAJOR_VERSION >= 3
分支相关问题 更多 >
编程相关推荐