내 Windows 응용 프로그램에 Python 2.6이 포함되어 있습니다 (예전에 알고 있었지만 우리가 함께 사용해야하는 것입니다). 그것은 기본 파이썬 명령을 실행할 수 있지만 "DLL을 찾을 수 없습니다"나는 오류 (126) 받고 있어요Python이 msvcr90.dll을 열 수 없습니다.
import ctypes
ctypes.WinDLL("msvcr90.dll")
를 실행하려고 실패합니다. 응용 프로그램에서 DLL을 발견하면 오류 1114 "DLL 초기화 루틴이 실패했습니다."가 표시됩니다.
는 업데이트]이 프로그램의 단순한 재현 할 수 있습니다
#include <math.h>
#include <iostream>
#undef _DEBUG
#include <Python.h>
int main(int argc, char* argv[])
{
Py_SetProgramName(argv[0]);
Py_Initialize();
PyRun_SimpleString("import pyreadline\n");
Py_Finalize();
std::cout << "Press enter: " << std::endl;
char c;
std::cin.read(&c, 1);
return 0;
}
x86 및 AMD64 아키텍처에서, V9 또는 V10 툴체인 중 하나를 컴파일 할 때 실패합니다. 다음과 같이
역 추적은 다음과 같습니다
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python26-x86\lib\site-packages\pyreadline\__init__.py", line 9, in <m
odule>
import unicode_helper, logger, clipboard, lineeditor, modes, console
File "C:\Python26-x86\lib\site-packages\pyreadline\console\__init__.py", line
14, in <module>
from console import *
File "C:\Python26-x86\lib\site-packages\pyreadline\console\console.py", line 6
05, in <module>
msvcrt = cdll.LoadLibrary(ctypes.util.find_msvcrt())
File "C:\Python26-x86\Lib\ctypes\__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "C:\Python26-x86\Lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
-- or alternatively --
WindowsError: [Error 1114] A dynamic link library (DLL) initialization routine f
ailed
은 내가 ctypes.py
에 print self._name
를 삽입하기 때문에로드되는 DLL이 msvcr90.dll 것을 알고있다.
응용 프로그램은 pyreadline
을로드하는 것을 제외하고 필자가 필요로하는 대부분의 파이썬 스크립트를 실행합니다.
동일한 스크립트는 설치된 Python 실행 파일에서 문제없이 실행됩니다.
왜 이런 이유가있을 수 있습니까?
업데이트 2 단순한 LoadLibrary("msvcr90.dll")
도 실패합니다. 'net'의 여러 위치에서 권장하는대로 응용 프로그램 매니페스트에 DLL을 추가했습니다. 이것은 도움이되지 않았습니다.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
이 매니페스트 및 python.exe를에 포함 된 매니페스트가 일치 할, 아직 python.exe를이 DLL을 열 수 있습니다 내 응용 프로그램을 수행 할 수 없습니다 여기에 실행 파일에 포함로 매니페스트입니다. 나는 당혹 스럽다.
Windows 응용 프로그램은 어떤 버전의 C/C++로 작성 되었습니까? – martineau
@martineau vs2010 (toolchain v10.0, msvcr100.dll) –
나는 그것이 문제의 원인 일 수 있다고 생각합니다. 동시에 두 개의 다른 C/C++ 런타임 라이브러리를 동시에 사용하는 프로그램을 만들려고합니다. Offhand, 내가 파이썬 버전의 옛날 생각할 수있는 유일한 해결책은 VS2010을 사용하여 직접 재구성하려고하는 것입니다. – martineau