当前位置: 首页 > 知识库问答 >
问题:

使用scipy的Pyinstaller。信号导入错误:DLL加载失败

吴兴国
2023-03-14

我使用PyInstaller 3.3、Python3.4编译了一个需要使用scipy的程序。信号函数,它导致了。exe在启动时立即崩溃。我一直在stack overflow和其他网站上搜索,试图包含正确的DLL,但没有结果。请帮助我确定是否需要在我的应用程序中包含一些特定的DLL。规格文件或包含其他一些隐藏的导入!

以下是我的PyInstaller命令:

pyinstaller --noupx --hidden-import=tkinter --hidden-import=scipy --hidden-import=matplotlib constantG_constantHz.py

下面是启动我的exe后命令提示符中相应的错误:

Traceback (most recent call last):

  File "constantG_constantHz.py", line 16, in <module>

  File "C:\Users\esandberg\AppData\Local\Continuum\anaconda3\envs\py34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)

  File "site-packages\scipy\signal\__init__.py", line 304, in <module>

  File "C:\Users\esandberg\AppData\Local\Continuum\anaconda3\envs\py34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)

  File "site-packages\scipy\signal\bsplines.py", line 12, in <module>

  File "C:\Users\esandberg\AppData\Local\Continuum\anaconda3\envs\py34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)

  File "site-packages\scipy\special\__init__.py", line 640, in <module>

  File "C:\Users\esandberg\AppData\Local\Continuum\anaconda3\envs\py34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)

ImportError: DLL load failed: The specified module could not be found.

[1272] Failed to execute script constantG_constantHz

这是我的。等级库文件:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['constantG_constantHz.py'],
             pathex=['C:\\Users\\esandberg\\Desktop'],
             binaries=[],
             datas=[],
             hiddenimports=['tkinter', 'scipy', 'matplotlib'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='constantG_constantHz',
          debug=False,
          strip=False,
          upx=False,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=False,
               name='constantG_constantHz')

共有2个答案

张高澹
2023-03-14

问题是很多丢失的dll。PyInstaller在查找大部分Smpy的dll时遇到了问题,所以我不得不指定了很多。我将在下面发布我的. spec文件,以防有人想看到/复制我必须引入的dlls。有些事情可能是不必要的,但它是有效的,所以我不会弄乱它。请确保您指向正确的目录为您的系统虽然-它不会是相同的,因为我的,所以不要只是复制/粘贴:)

# -*- mode: python -*-

block_cipher = None

mkl_dlls =     [('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_avx.dll', '.'),
     ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_avx2.dll', '.'),
     ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_avx512.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_core.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_def.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_intel_thread.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_mc.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_mc3.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_rt.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_sequential.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_tbb_thread.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_avx.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_avx2.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_avx512.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_cmpt.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_def.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_mc.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_mc2.dll', '.'),
 ('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\mkl_vml_mc3.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\numpy\\core\\libiomp5md.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libansari.R6EA3HQP5KZ6TAXU4Y4ZVTRPT7UVA53Z.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libbanded5x.WZIUXDGQF4EXGFMCS2HGNLMUYHBRQUUF.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libbispeu.5N2XSD7URZS4WTOSLTOG4DDMA4HGB46U.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libblkdta00.LJOUU3SAGG47ULUG76DDJIAQ3SJZPC3K.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libchkder.6HLXPVTQJEGRZGLI5DFRMNW3SS76BHP6.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libcobyla2.JEGTSUUFJ7DFXWZN5PAYZTTLBDATC4WD.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdcosqb.K4J3XBR4PEETMRHZICUWW4LXG5UONZ34.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdcosqb.QRGA36MB6CFHWLQN6ETWARR4M4E6P3C2.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdcsrch.I2AOPDCXAPDRFNPWY55H5UE7XZSU5CVN.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdet.6GZFPKJ7BNDGVB7LFKBA6Z6U3VHYDRNY.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdfft_sub.U4F67CR5EXPQGGTDKQXO4Q644NUQ3EQ6.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdfitpack.2Y4SCYSHMU4DXJIF3BLBGBCDGFPGNXB5.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdgamln.VNYWJHKRIIPRROV3CUDLW473BST7CGWP.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdop853.6TJTQZW3I3Q3QIDQHEOBEZKJ3NYRXI4B.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libdqag.62LLADARAQRQLGIRWJXRQ7DKBCHYVFM7.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libd_odr.QDWMEQYLAGCKZEYTV3WWPRP5CLZ3G4WQ.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\liblbfgsb.T5BNFBSTQTIIF6ISVJFBJAWBU7OKBGPL.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libmvndst.LY22DRRGFBEFI34ZKZWNM3LQKXRWY2M2.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libnnls.5LTQOLAJY5PFO6MOEXWNMRWVFRWHYHKT.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libslsqp_op.NNY57ZXZ43A4RH3YWFA7BKHP5PC2K3I5.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libspecfun.PT6DS3HUOGYNSXUO4OUKK6ATA7B5KP2K.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libSTOPTEST.ULMD4CATLBJOTE3KABHKOG56HAQIX5F6.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libvode.XW5WVKKTDJOOC5XUHCVKZ4AYR2TXGRF4.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libwrap_dum.G2F2CGV7KURTEF5GFBNVGKVM6FV5JBCV.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\libwrap_dum.XGSO5H22J6VUAWYNCLIXCV2EJ754HJMI.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\lib_arpack-.BSIUF6E2Z6VKRD6SNEY37WASTOLCKTAP.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\lib_blas_su.C3OGRVVRISPWLMOVEY4KXYSPKJEZ7QG6.gfortran-win_amd64.dll', '.'),
('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\envs\\py34\\Lib\\site-packages\\scipy\\extra-dll\\lib_test_fo.JF5HTWMUPBXWGAYEBVEJU3OZAHTSVKCT.gfortran-win_amd64.dll', '.')]

a = Analysis(['constantG_constantHz.py'],
         pathex=['C:\\Users\\esandberg\\Desktop'],
         binaries=mkl_dlls,
         datas=[('C:\\Users\\erik\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\scipy\\special\\_ufuncs_cxx.cp36-win_amd64.pyd','.'),],
         hiddenimports=['scipy._lib.messagestream', 'numpy', 'tkinter', 'scipy', 'matplotlib', 'fixtk', 'scipy.signal', 'scipy.signal.bsplines', 'scipy.special', 'scipy.special._ufuncs_cxx',
                        'scipy.linalg.cython_blas',
                        'scipy.linalg.cython_lapack',
                        'scipy.integrate',
                        'scipy.integrate.quadrature',
                        'scipy.integrate.odepack',
                        'scipy.integrate._odepack',
                        'scipy.integrate.quadpack',
                        'scipy.integrate._quadpack',
                        'scipy.integrate._ode',
                        'scipy.integrate.vode',
                        'scipy.integrate._dop', 'scipy._lib', 'scipy._build_utils','scipy.__config__',
                        'scipy.integrate.lsoda', 'scipy.cluster', 'scipy.constants','scipy.fftpack','scipy.interpolate','scipy.io','scipy.linalg','scipy.misc','scipy.ndimage','scipy.odr','scipy.optimize','scipy.setup','scipy.sparse','scipy.spatial','scipy.special','scipy.stats','scipy.version'],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      name='constantG_constantHz',
      debug=False,
      strip=False,
      upx=False,
      runtime_tmpdir=None,
      console=True )
贺季同
2023-03-14

我以前尝试过这些方法,但并没有解决我的问题。最后,我用这种方式解决了。

在命令(cmd)窗口中编译可执行文件(exe)文件时,我的命令编写如下:

pyinstaller -F --paths C:\Users\Desktop\Code\2018.04.23\venv\Lib\site-packages\scipy\extra-dll pdf_num_detect.py

希望这个小技巧能帮到大家。

 类似资料:
  • 问题内容: 我已经使用python 3.6在Windows机器上安装了opencv,没有任何问题,使用: 但是当我尝试导入cv2时,出现以下错误 我看过这篇文章 它说cv2不适用于python 3我在想这是否已修复或是否有解决方法 问题答案: 您可以从此非官方站点上在Windows 32位或64位计算机上下载最新的适用于Python 3.6的OpenCV 3.2.0,查找以开头的文件。然后键入以下

  • 我想在Windows servre 2016(X 5650 x64处理器,Dell Power Edge 710)中运行tensorflow python程序。相同的环境在本地pc上工作,但在服务器设备中显示错误。 错误: Traceback(最近一次调用最后一次):文件"C:\用户\管理员\AppData\本地\程序\Python\Python38\lib\site-包\tenorflow\py

  • 问题内容: 我已经在Windows平台上安装了PyQt5,并且遇到了importError:DLL加载失败。 我已经使用以下命令安装了pyqt5 我的Python版本如下: 导入错误如下: 感谢和问候 问题答案: 这是因为丢失(存根dll,会重新导出功能,以便扩展的一个版本可用于多个python版本)。 如果您的Python发行版未捆绑python3.dll,则可以从WinPython(https

  • 问题内容: 我正在使用python 2.7.2和Windows7。我通过互联网,帮助和其他来源进行了搜索,但找不到我的问题的答案。 我的一个来源进口了,这一个进口。此刻它说: 我搜索了_tkinter,并在Python27 / libs中找到了它作为一个lib文件。 在许多站点上都说要安装或,但是我没有找到用于Windows的单独安装。 使用http://www.python.org/getit/

  • 问题内容: 我真的不想对此提出自己的问题,因为这似乎是一个常见错误。但是,由于现在已经浪费了数小时并且关注了我所能找到的每个线程,因此给出的答案都没有为我解决这个问题。 因此,我唯一的选择是提供我所能提供的有关我的设置的所有信息,并希望你们中的一个能认识到问题。 我正在Windows 10(x64)上运行,并从此处的集合中安装了以下预构建的二进制文件。 python 3.5.0-win32(从py

  • 系统信息: win10 python 3.6。2. tensorflow 1.11。0 numpy 1.15。3. 康达4.3。30 cuda 8.0 cudnn6.0 pip 18.1 我用python3创建了一个新环境。6.2在anaconda安装了tensorflow和pip,遇到这样的问题,谢谢帮助。 Python 3.6。2 | Continuum Analytics,Inc.|(默认,