我试图将Python嵌入到C应用程序中,但似乎无法使其正常工作。 我的代码是
using System;
using Python.Runtime;
namespace NLP.Python
{
public class PythonRumtime
{
public PythonRuntime()
{
//Location of python installation
PythonEngine.PythonHome = "C:\\Python27";
PythonEngine.Initialize();
}
}
}
当我试图创建这个类的实例时,代码在调用时没有任何错误Python引擎。初始化() 我已经添加了一个dll引用Python.运行时是用Python装的。在
我不知道还能做什么。在
我已经通过pip在一台安装了pythonnet 2.7.11的32位windows64位机器上安装了pythonnet-2.1.0。在
编辑错误似乎发生在调用中的Py_Initialize()时Python.Runtime.dll. 根据https://docs.python.org/2/c-api/init.html“没有返回值;如果初始化失败,这是一个致命错误。”
这是个窃听器python.org网站用于python 2.7.11 32位的官方windows安装程序:
https://bugs.python.org/issue25824
试试Python,也许是WinPython或者python2.7.10。在
相关问题 更多 >
编程相关推荐