我正在使用Python-VLC创建视频播放器,并使用PyInstaller在Windows 10计算机上生成可执行文件。最初,它给了我错误:
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。我在这里还有其他东西吗?关于如何处理此问题有什么建议吗?
我有相同的错误,您是否找到了解决方案?