Pyinstaller找不到libvlc.dll

时间:2019-08-24 21:43:24

标签: python dll pyinstaller libvlc

首先,我知道有人问过类似的问题,但是我找不到解决问题的方法。谢谢您的帮助!

我一直在尝试使用pyinstaller创建可执行文件,但在让pyinstaller查找libvlc的.dll时遇到麻烦。特别是:libvlc.dll和libvlccore.dll。这些位于我的VideoLAN \ VLC目录中,但是我还将所有dll从我的VideoLAN \ VLC目录复制到了test.py和test.spec文件旁边的Compile目录中。我也将我的VideoLAN \ VLC目录添加到了环境变量中,以帮助pyinstaller找到它们。 尽管如此,当我运行pyinstaller test.spec时,仍收到此警告:

48352 WARNING: lib not found: libvlccore.dll dependency of C:\Users\chipc\Desktop\Code\Python\KivyTest\KivyTut\Compile\libvlc.dll

其余的编译日志可以在这里查看:https://pastebin.com/DJmkQ7nm

当尝试运行生成的test.exe时,它会给我以下信息:

Traceback (most recent call last):
File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 149, in __init__
File "ctypes\__init__.py", line 356, in __init__
OSError: [WinError 193] %1 is not a valid Win32 application

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 18, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\users\chipc\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\vlc.py", line 207, in <module>
File "site-packages\vlc.py", line 163, in find_lib
File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 151, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\chipc\\Desktop\\Code\\Python\\KivyTest\\KivyTut\\Compile\\dist\\test\\libvlc.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[16044] Failed to execute script test

此外,包含test.exe的生成文件夹中确实包含libvlc.dll。

这是我的test.spec文件:

# -*- mode: python ; coding: utf-8 -*-
from kivy_deps import sdl2, glew
block_cipher = None


a = Analysis(['test.py'],
             pathex=[('C:\\Users\\chipc\\Desktop\\Code\\Python\\KivyTest\\KivyTut\\Compile'), ('C:\Program Files\VideoLAN\VLC')],
             binaries=[('./libvlc.dll', '.'), ('./axvlc.dll', '.'), ('./libvlccore.dll', '.'), ('./npvlc.dll', '.')],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
a.datas += Tree('C:\\Program Files\\VideoLAN\\VLC\\plugins', prefix='plugins')
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='test',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe, Tree('C:\\Users\\chipc\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages\\kivy_deps'),
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               name='test')

该程序可在PyCharm中使用。如何让pyinstaller查找libvlc.dll?

以防万一,这是我的Compile目录的样子:

axvlc.dll
libvlc.dll
libvlccore.dll
npvlc.dll
test.py
test.spec

感谢您的帮助,我已经尝试了几天了!

0 个答案:

没有答案