如何在本地目录中有 avbin.dll(不是 C:\Windows\System)(对于 pyglet 1.2.4)
How to have avbin.dll in a local directory (not C:\Windows\System) (for pyglet 1.2.4)
使用 pyglet 1.2.4,我正在使用 avbin.dll 来播放音频,所有来源都说它需要进入 C:\Windows\System。这行得通,但我想放在一个本地文件夹中,这样当它被下载时,用户不需要明确地把它放在那里。
如何才能指定avbin.dll/have的目录与代码在同一个文件夹中?
在这里,avbin.dll在代码所在的文件夹中,但我找不到他们是如何做到的。
https://github.com/surajsinghbisht054/Python-Media-Player/tree/master/Python%20Media%20Player%20Version%200.0.1/Tools
我尝试浏览它,但没有找到任何东西
我试过了
pyglet.options["search_local_libs"]
但它已经设置为 true。
我也将它添加到路径变量中,但这并没有改变任何东西。
目的是为了能够播放音频文件。
另外:
使用 pyglet 1.4,我尝试使用 ffmpeg
和 ffmpeg-pyglet
,效果很好,除了 pyglet.app.run()
需要停止重复播放曲目的第一部分,但它的主循环干扰了 tkinter 的而且我似乎无法在线程中工作,这就是我恢复到 1.2.4 的原因。
如果您将 avbin dll 放在您的文件夹中(或使用安装程序将其全局安装),则写入:
导入pyglet后,像这样:
import pyglet
pyglet.lib.load_library('avbin')
pyglet.have_avbin=True
它将加载并使用 avbin
注意:有时在这种情况下会发生 dll 未找到错误,将 avbin.dll [如果您使用的是 32 位 python] 复制粘贴到 windows->SysWOW64 目录。
这可以通过使用 NSIS [Nullsoft Scriptable Install System] 创建安装程序来解决。使用 NSIS 创建安装程序很容易,仅供参考,我将向您展示!
!include LogicLib.nsh
!include x64.nsh
# define installer name
OutFile "mp3player_installer.exe"
;set the default install directoy to programfilesx86
InstallDir $PROGRAMFILES32
Section
;checking system architechure
;if 64bit set the installation path to SysWOW64 else to system32
${If} ${RunningX64}
SetOutPath "$WINDIR\SysWOW64\"
File avbin.dll
${Else}
SetOutPath "$WINDIR\System32\"
File avbin.dll
${EndIf}
SectionEnd
Section
;set the output path to programfilesx86/Application dir
SetOutPath "$INSTDIR\Mp3Player\"
;the file need to copy ref with File Attribute you can set multiple file refs here
File Application.py
;just create an uninstaller
WriteUninstaller "$INSTDIR\Mp3Player\uninstall.exe"
SectionEnd
Section "Uninstall"
# Always delete uninstaller first
Delete "$INSTDIR\Mp3Player\uninstaller.exe"
# now delete installed file
Delete "$INSTDIR\Mp3Player\Application.py"
Delete "$WINDIR\SysWOW64\avbin.dll"
SectionEnd
您可以安装 NSIS 应用程序并创建一个 installer.nsi 文件并复制此代码并通过右键单击 installer.nsi 文件和 select 使用 NSIS 脚本编译脚本来编译脚本结果将为您生成一个安装程序!
使用 pyglet 1.2.4,我正在使用 avbin.dll 来播放音频,所有来源都说它需要进入 C:\Windows\System。这行得通,但我想放在一个本地文件夹中,这样当它被下载时,用户不需要明确地把它放在那里。
如何才能指定avbin.dll/have的目录与代码在同一个文件夹中?
在这里,avbin.dll在代码所在的文件夹中,但我找不到他们是如何做到的。 https://github.com/surajsinghbisht054/Python-Media-Player/tree/master/Python%20Media%20Player%20Version%200.0.1/Tools 我尝试浏览它,但没有找到任何东西
我试过了
pyglet.options["search_local_libs"]
但它已经设置为 true。
我也将它添加到路径变量中,但这并没有改变任何东西。
目的是为了能够播放音频文件。
另外:
使用 pyglet 1.4,我尝试使用 ffmpeg
和 ffmpeg-pyglet
,效果很好,除了 pyglet.app.run()
需要停止重复播放曲目的第一部分,但它的主循环干扰了 tkinter 的而且我似乎无法在线程中工作,这就是我恢复到 1.2.4 的原因。
如果您将 avbin dll 放在您的文件夹中(或使用安装程序将其全局安装),则写入:
导入pyglet后,像这样:
import pyglet
pyglet.lib.load_library('avbin')
pyglet.have_avbin=True
它将加载并使用 avbin
注意:有时在这种情况下会发生 dll 未找到错误,将 avbin.dll [如果您使用的是 32 位 python] 复制粘贴到 windows->SysWOW64 目录。
这可以通过使用 NSIS [Nullsoft Scriptable Install System] 创建安装程序来解决。使用 NSIS 创建安装程序很容易,仅供参考,我将向您展示!
!include LogicLib.nsh
!include x64.nsh
# define installer name
OutFile "mp3player_installer.exe"
;set the default install directoy to programfilesx86
InstallDir $PROGRAMFILES32
Section
;checking system architechure
;if 64bit set the installation path to SysWOW64 else to system32
${If} ${RunningX64}
SetOutPath "$WINDIR\SysWOW64\"
File avbin.dll
${Else}
SetOutPath "$WINDIR\System32\"
File avbin.dll
${EndIf}
SectionEnd
Section
;set the output path to programfilesx86/Application dir
SetOutPath "$INSTDIR\Mp3Player\"
;the file need to copy ref with File Attribute you can set multiple file refs here
File Application.py
;just create an uninstaller
WriteUninstaller "$INSTDIR\Mp3Player\uninstall.exe"
SectionEnd
Section "Uninstall"
# Always delete uninstaller first
Delete "$INSTDIR\Mp3Player\uninstaller.exe"
# now delete installed file
Delete "$INSTDIR\Mp3Player\Application.py"
Delete "$WINDIR\SysWOW64\avbin.dll"
SectionEnd
您可以安装 NSIS 应用程序并创建一个 installer.nsi 文件并复制此代码并通过右键单击 installer.nsi 文件和 select 使用 NSIS 脚本编译脚本来编译脚本结果将为您生成一个安装程序!