Python VLC的PyInstaller:无属性;媒体“新播放器”;错误
我正在使用PythonVLC创建一个视频播放器,并使用PyInstaller在我的Windows10机器上生成可执行文件。 最初,它给了我一个错误:Python VLC的PyInstaller:无属性;媒体“新播放器”;错误,python,dll,windows-10,pyinstaller,python-vlc,Python,Dll,Windows 10,Pyinstaller,Python Vlc,我正在使用PythonVLC创建一个视频播放器,并使用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 =
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。我还缺什么吗?
对如何处理这个问题有什么建议吗 这个问题的一个常见答案是确保安装了VLC主程序,因为VLC.py依赖它。而且,Python和libvlc.dll都必须是32位的,或者都必须是64位的