使用pybind11,我想嵌入多个解释器:我想启动多个线程,在每个线程中,启动一个解释器,eval_文件,然后停止解释器并关闭线程。
基本上,这是一个线程函数:
pybind11::scoped_interpreter guard{};
pybind11::eval_file(python_filename);
编译是可以的,但是在运行时我得到:
terminate called after throwing an instance of 'std::runtime_error'
what(): The interpreter is already running
我想这是不可以的。但是为什么?它怎么会知道呢?