Pyinstaller - WindowsError:[错误126]找不到指定的模块

时间:2015-09-19 14:09:36

标签: runtime-error pyinstaller

你好了解读者,

我在使用pyinstaller创建exe时遇到一些麻烦,因此在运行时,我收到错误消息:

  File "<string>", line 17, in <module>
  File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\shapely.geometry", line 4, in <module>
  File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\shapely.geometry.base", line 9, in <module>
  File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\shapely.coords", line 8, in <module>
  File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\shapely.geos", line 15, in <module>
  File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\shapely.libgeos", line 184, in <module>
  File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\ctypes", line 365, in __init__
WindowsError: [Error 126] The specified module could not be found

据我所知,这是一个DLL问题。但是,它没有指定哪一次导致问题。我使用--log-level = debug进行了调试并将其粘贴在下面。我还检查了pyinstaller的警告消息,但无法辨别错误原因。

是否有任何关于可能导致此错误的建议?

非常感谢

从构建时的输出中截取:

24094 INFO: Adding Microsoft.VC90.MFC to dependent assemblies of final executable
24222 INFO: Searching for assembly x86_Microsoft.VC90.MFC_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
24223 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86.manifest
24223 INFO: Searching for file mfc90.dll
24225 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90.dll
24225 INFO: Searching for file mfc90u.dll
24225 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90u.dll
24225 INFO: Searching for file mfcm90.dll
24225 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfcm90.dll
24225 INFO: Searching for file mfcm90u.dll
24225 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfcm90u.dll
26147 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.6161_none ...
26147 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57.manifest
26148 INFO: Searching for file msvcr90.dll
26148 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll
26148 INFO: Searching for file msvcp90.dll
26148 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll
26149 INFO: Searching for file msvcm90.dll
26149 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcm90.dll
26516 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
27055 INFO: Using Python library C:\Windows\system32\python27.dll
27253 INFO: Warnings written to C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\warngis_helper2.txt
27286 INFO: checking PYZ
27286 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
27286 INFO: building PYZ (ZlibArchive) out00-PYZ.toc
33585 INFO: checking PKG
33585 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
33585 INFO: building PKG (CArchive) out00-PKG.pkg
60197 INFO: checking EXE
60197 INFO: rebuilding out00-EXE.toc because GIS_Helper.exe missing
60197 INFO: building EXE from out00-EXE.toc
60202 INFO: Appending archive to EXE C:\Users\Hp\PycharmProjects\GISdev\dist\GIS_Helper.exe

1 个答案:

答案 0 :(得分:0)

问题是geos_c.dll文件。 Pyinstaller没有自动提取它。我尝试将其复制到正在执行spec文件的构建目录中。但这还不够,解决方案是编辑spec文件以包含geos_c.dll

# -*- mode: python -*-
a = Analysis(['GIS_Helper.py'],
             pathex=['C:\\Users\\Hp\\PycharmProjects\\GISdev'],
             hiddenimports=['scipy.linalg.cython_blas', 'scipy.linalg.cython_lapack', 'scipy.special._ufuncs_cxx', 'multiprocessing', '_multiprocessing', 'multiprocessing.process', 'multiprocessing.util', 'ctypes.util', 'pandas.util', 'distutils.util', 'shapely'],
             hookspath=None,
             runtime_hooks=None)



a.binaries=['geos_c.dll', 'geos_c.dll', 'BINARY'],

pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          [('v',None,'OPTION')],
          a.binaries,
          a.zipfiles,
          a.datas,
          name='GIS_Helper.exe',
          debug=True,
          strip=None,
          upx=True,
          console=True )