Boost Python Embedding Error

走远了吗. 提交于 2019-12-11 09:44:55

问题


I've just built Boost Python on Windows 10 with an Anaconda version of Python 3.5 (64 bit). I used these instructions modified to my suit my installation and have successfully built the testCode.cpp using Visual Studio 2015:

#include <boost/python.hpp>  
using namespace boost::python;  

int main()  
{  
    try {  
        Py_Initialize();  

        object main_module((  
            handle<>(borrowed(PyImport_AddModule("__main__")))));  

        object main_namespace = main_module.attr("__dict__");  

        handle<> ignored(( PyRun_String( "print (\"Hello, World\")",  
            Py_file_input,  
            main_namespace.ptr(),  
            main_namespace.ptr() ) ));  
    } catch( error_already_set ) {  
        PyErr_Print();  
    }  
}  

However when I run the application I get these errors:

C:\Users\Stephen\Source\Repos\TestPythonEmbedding\x64\Release>TestPythonEmbedding
Failed to import the site module
Traceback (most recent call last):
File "C:\Users\Stephen\Anaconda3\Lib\site.py", line 73, in <module>
import os
File "C:\Users\Stephen\Anaconda3\Lib\os.py", line 652, in <module>
from _collections_abc import MutableMapping
File "C:\Users\Stephen\Anaconda3\Lib\_collections_abc.py", line 64
async def _ag(): yield
                ^
SyntaxError: 'yield' inside async function

Does anyone know what's wrong here and how to fix it?

Thanks

来源:https://stackoverflow.com/questions/48552092/boost-python-embedding-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!