You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PyInstaller打包含ffpyplayer.player.MediaPlayer的Python程序时,无法定位缺失DLL的问题求助

PyInstaller打包含ffpyplayer.player.MediaPlayer的Python程序时,无法定位缺失DLL的问题求助

大家好,我遇到了一个PyInstaller打包的难题,想请各位帮忙分析下:

我有一个Python脚本,在命令行运行完全正常,但自从引入ffpyplayer库后,打包成exe就一直报错——始终无法加载ffpyplayer模块。

我执行的打包命令是:

pyinstaller Video.spec --clean

我的spec文件内容如下:

# -*- mode: python ; coding: utf-8 -*-

import os

a = Analysis(
    ['Video.py'],
    pathex=[],
    binaries= [
        ('ffprobe.exe', '.'),
        ('ffmpeg.exe', '.'),
        ('C:/temp/video/dll/avcodec-58.dll', '.'),
        ('C:/temp/video/dll/avdevice-58.dll', '.'),
        ('C:/temp/video/dll/avfilter-7.dll', '.'),
        ('C:/temp/video/dll/avformat-58.dll', '.'),
        ('C:/temp/video/dll/avutil-56.dll', '.'),
        ('C:/temp/video/dll/swresample-3.dll', '.'),
        ('C:/temp/video/dll/swscale-5.dll', '.'),
        ('C:/temp/video/dll/SDL2.dll', '.'),        
    ],
    datas=[('video.ico','.')],
    hiddenimports=[
        'ffpyplayer',   
        'ffpyplayer.threading',
        'ffpyplayer.queue',
        'ffpyplayer.player',            
        'ffpyplayer.tools',
        'ffpyplayer.pic',
        'ffpyplayer.writer',        
        'ffpyplayer.player.frame_queue',        
        'ffpyplayer.player.decoder',
        'ffpyplayer.player.clock',
        'ffpyplayer.player.core',       
        'ffpyplayer.player.player',
        'ffpyplayer.player.queue',              
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
)

pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='Video',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon=['video.ico'],
)

但运行生成的Video.exe时,弹出了如下错误:

Traceback (most recent call last):
  File "Video.py", line 16, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
  File "ffpyplayer\player\__init__.py", line 10, in <module>
ImportError: DLL load failed while importing player: The specified module could not be found.
[PYI-5408:ERROR] Failed to execute script 'Video' due to unhandled exception!

错误对应的是我Video.py里的这一行代码:

from ffpyplayer.player import MediaPlayer

我现在最困惑的是:我怎么才能确定到底缺失了哪个DLL呢?

我已经用pyi-archive_viewer查看了./dist/video.exe里的PKG/CArchive,里面包含的DLL列表如下:

'SDL2.dll'
'SDL2_mixer.dll'
'VCRUNTIME140.dll'
'VCRUNTIME140_1.dll'
'api-ms-win-core-console-l1-1-0.dll'
'api-ms-win-crt-utility-l1-1-0.dll'
'avcodec-58.dll'
'avcodec-60.dll'
'avdevice-58.dll'
'avdevice-60.dll'
'avfilter-7.dll'
'avfilter-9.dll'
'avformat-58.dll'
'avformat-60.dll'
'avutil-56.dll'
'avutil-58.dll'
'cv2\\opencv_videoio_ffmpeg4110_64.dll'
'libcrypto-3.dll'
'libffi-8.dll'
'libssl-3.dll'
'numpy.libs\\libscipy_openblas64_-43e11ff0749b8cbe0a615c9cf6737e0e.dll'
'numpy.libs\\msvcp140-d64049c6e3865410a7dda6a7e9f0c575.dll'
'postproc-55.dll'
'postproc-57.dll'
'pyexpat.pyd'
'python3.dll'
'python313.dll'
'select.pyd'
'swresample-3.dll'
'swresample-4.dll'
'swscale-5.dll'
'swscale-7.dll'
'tcl86t.dll'
'tk86t.dll'
'ucrtbase.dll'
'zlib1.dll'

实在搞不清楚到底是哪个DLL缺失了,希望各位能给点建议!

备注:内容来源于stack exchange,提问作者Harvey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 14:54:50