我想将我的 Python 版本从 2.7 更新到 3.5。
编译使用 PyString_InternFromString 和此 Py_InitModule 的代码时
我收到错误信息:
Error 199 error C3861: 'Py_InitModule': identifier not found
Error 196 error C3861: 'PyString_InternFromString': identifier not found
我的问题是,Python 3.5 中的那些标识符有什么等价物?
请您参考如下方法:
对于 Py_InitModule,您现在使用的是 PyModule_Create .可以看到example usage in the tutorial example on the Python docs page .
对于实习,Py3的str是基于Py2的unicode类型;在 C 层,您正在使用 PyUnicode 方法,例如PyUnicode_InternFromString .您仍在实习 Python 级别的 str,但实现类型已更改。
