繁体   English   中英

在Visual Studio 2005 C / C ++中嵌入wxPython失败

[英]embedding wxPython in VisualStudio 2005 C/C++ fails

当我尝试将python wx嵌入C时,如下所示:

#include "stdafx.h"
#ifdef _DEBUG
  #undef _DEBUG
  #include <Python.h>
  #define _DEBUG
#else
  #include <Python.h>
#endif

int _tmain(int argc, _TCHAR* argv[])
{
  PyObject* pyModule;
  Py_Initialize();
  //_pyModule = PyImport_ImportModule("__main__");
  //_pyModule = PyImport_ImportModule("csi");
  pyModule = PyImport_ImportModule("wx");
  if(!pyModule)
    PyErr_Print();
  return 0;
}

它失败:

->Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-2.8-msw-ansi\wx\__init__.py", line 45, in <module>
  from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-ansi\wx\_core.py", line 4, in <module>
  import _core_
  ImportError: DLL load failed: The specified module could not be found.

可能是msvc * 90.dll文件的问题?

我正在将VS2005,Python 2.7,wxPython 2.8.12.1(ansi)用于Python 2.7

将安装其他MS VC ++ 2008/2010可再发行组件。

感谢帮助。

最后我找到了解决方案:

这是一个清单问题。 多亏了Microsof dll-hell ...

这有助于:

//_core_.pyd ImportError
// _core_.pyd is in fact a dll. it can be renamed.
// The problem is that _core_.pyd depends on some Microsoft.VC90.CRT libraries
//this dependency must be added to make it work
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM