Python SWIG MinGW - setup.py builds the source and the pyd file, python cannot find the module.
Python SWIG MinGW - setup.py编译源文件和pyd文件,python找不到模块。
回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我使用MinGW来构建一个使用Swig的PythonC模块。当我告诉Python加载模块时,它失败并抱怨Python找不到模块。在</p>
<p>有趣的是,该模块与我在<em>中运行Python的目录相同,</em>该模块名为<code>_mod.pyd</code>。(我还生成了一个<code>mod.py</code>文件,该文件在同一路径中使用<code>_mod.pyd</code>。)</p>
<p>你不相信真让人沮丧!在</p>
<pre><code>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mod.py", line 25, in <module>
_mod = swig_import_helper()
File "mod.py", line 21, in swig_import_helper
_mod = imp.load_module('_mod', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.
</code></pre>
<p>它构建得很干净(我使用的是distutils),并且我所有的dll都位于一个已经暴露到PATH的目录中。在</p>
<p>我使用的是WindowsXP+MinGW平台(最新稳定的MinGW)。在</p>
<p>谢谢!在</p>