<p>我将DLL <code>UdfManagerPython.dll</code>加载到<a href="http://www.dependencywalker.com/" rel="nofollow">Dependency Walker</a>中,它指出这个DLL依赖于<code>python22.dll</code>。当我试图在Python(2.7)解释器中加载这个DLL时,我得到了一个消息框,或多或少告诉了我同样的事情:</p>
<blockquote>
<p>The program can't start because python22.dll is missing from your computer. Try reinstalling the program to fix this problem.</p>
</blockquote>
<p>因此,这个DLL似乎是打算与Python 2.2一起使用的,而不是您正在使用的python2.7。</p>
<p>我没有安装Python2.2。如果你这样做了,也许你会收到不同的错误信息给我。</p>
<p>还值得指出的是,Python 2.2不能使用<code>ctypes</code>,因为<a href="http://python.net/crew/theller/ctypes/" rel="nofollow">^{<cd3>} is only supported for Python 2.3 onwards</a>。</p>
<p>我不知道这个DLL是从哪里来的。我搜索了它的名字,得到了四个结果,其中一个是这个问题。</p>
<p>顺便说一下,如果可以找到DLL本身,但缺少DLL的依赖项,则我看到了“找不到指定模块”表单的错误。因此,如果您收到这样的消息,并且您确定DLL本身存在,请检查其依赖项。</p>
<p><strong>编辑</strong>:我试图安装Python2.2以查看是否可以加载此DLL。安装了Python 2.2之后,您至少可以加载这个DLL,但是如果您试图调用<code>init...</code>方法之一,Python就会崩溃。(我不知道要传递哪些参数,所以没有传递任何参数。)</p>
<p>下面是我尝试调用以下方法时发生的情况:</p>
<pre>
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> l = CDLL("UdfManagerPython.dll")
>>> l.initPyUdfNumber()
Fatal Python error: Interpreter not initialized (version mismatch?)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.</pre>
<p>我在google上搜索了这个错误消息的第一行,我从大多数结果中得到的反复出现的主题是,这个错误表示您试图加载一个扩展模块,该模块链接到一个版本的Python和另一个版本的Python。</p>
<p>所以在回答您在评论中的问题时,不,我不认为有办法在Python2.7中加载这个DLL。</p>