我正在使用Python-VLC创建一个视频播放器,并使用PyInstaller在我的Windows10机器上生成可执行文件。最初,它给了我一个错误:
Import Error Failed to load dynlib/dll 'libvlc.dll'. Most probably this dynlib/dll was not found when the application was frozen.为了解决这个问题,我用以下方式在.spec文件的二进制文件中添加了缺少的dll:
a = Analysis(['video_player.py'],
pathex=['C:\\Users\\harsh\\Desktop\\demo\\Video'],
binaries=[("C:\\Program Files\\VideoLAN\\VLC\\libvlc.dll","."),("C:\\Program Files\\VideoLAN\\VLC\\libvlccore.dll",".")],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)在这样做之后,我不再得到上面的错误。但是,现在我得到了以下错误:
Exception in thread Thread-3:
Traceback (most recent call last):
File "threading.py", line 914, in _bootstrap_inner
File "threading.py", line 862, in run
File "video_player.py", line 100, in vlc_player
AttributeError: 'NoneType' object has no attribute 'media_player_new'导致此错误的代码为:
i=vlc.Instance('--fullscreen')
p=i.media_player_new()我已经确定我已经安装了Python-VLC。我还漏掉了什么吗?对如何处理这个问题有什么建议吗?
发布于 2021-02-26 05:37:09
解决这个问题的一个常见方法是确保你安装了VLC主程序,因为vlc.py依赖于它。而且,Python和libvlc.dll都必须是32位的,或者都必须是64位的。
https://stackoverflow.com/questions/60247035
复制相似问题