簡體   English   中英

Python 3.5 中的 Py_InitModule 和 PyString_InternFromString

[英]Py_InitModule and PyString_InternFromString in Python 3.5

我想將我的 Python 版本從 2.7 更新到 3.5。

當編譯代碼,使用PyString_InternFromStringPy_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 您可以在 Python 文檔頁面上的教程示例中查看示例用法

對於實習,Py3 的str基於 Py2 unicode類型; 在 C 層,您使用的是PyUnicode方法,例如PyUnicode_InternFromString 您仍在實習 Python 級別str ,但實現類型已更改。

https://stackoverflow.com/a/28306354/320546將幫助您使用Py_InitModulePyStr_InternFromString是 Python 3 等效的PyString_InternFromString (請參閱http://py3c.readthedocs.org/en/latest/reference.html#c.PyStr_InternFromString )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM