c++调用python遇到的问题 总结
1、PyEval_CallObjectWithKeywords python39弃用https://bugs.python.org/issue42181The current 3.9 docs do not describe PyEval_CallObjectWithKeywords, among other PyEval_CallObject* functions.Yes, I know, th
·
1、PyEval_CallObjectWithKeywords python39弃用
https://bugs.python.org/issue42181
The current 3.9 docs do not describe PyEval_CallObjectWithKeywords, among other PyEval_CallObject* functions.
Yes, I know, these functions are deprecated. But they are still part of the API; they ought to be documented.
Rather, given that they are deprecated, there is more need than ever to document them: The documentation should specify when they have been deprecated, until then they are guaranteed to be supported, and most importantly, how they are to be replaced.
Fulltext search leads me to the 3.9 Changelog that says: »PyEval_CallFunction, PyEval_CallMethod and PyEval_CallObjectWithKeywords are deprecated. Use PyObject_Call() and its variants instead.« This is far not enough. As a maintainer of 3rd-party code with no knowledge of and no interest in the Python C API, I do not want to spend half a day on finding out which variant to use, and how argument lists differ.
2、error C3861: “PyString_FromString”: 找不到标识符解决方案
------解决方案--------------------
google了一下,发现c3861是个国际问题
看了几篇都没说具体解决方案,只有一片提到用 PyModule_Create() 解决,但只是也没说详细
不懂vs,参考一下
------解决方案--------------------
这儿(http://stackoverflow.com/questions/8229597/embedding-python)提到:
python3没有PyString_*了,改为PyBytes_*,等等。
3、
PyString_
functions were renamed to PyBytes_
.
PyInt_
functions are gone, PyLong_
should be used instead.
更多推荐
所有评论(0)