Pyinstaller可执行的可执行文件不与Panda3D合作。没有图形管道可用
我对使用Panda3D的程序有一个问题。当作为pythonscript执行时,它可以很好地工作,但是Pyinstaller编译(或更确切地说是包装)的版本将下面的异常抛出。
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
通常,panda3d站点包目录的etc子目录中有一个config.prc文件。该文件在包装版本中不存在。但是,如果我在那里创建此子目录,并将文件复制到它,它仍然不起作用,并且仍然会引发相同的异常。我的主要程序也有一个“ LoadPrcdata(“ Win-Size 1080 1920”)”行。这可以以任何方式成为问题的一部分吗?还是我缺少其他东西?
提前致谢
I am having an issue with a program, which uses panda3d. It works perfectly when executed as a pythonscript, but the version, which is compiled (or rather packaged) by PyInstaller throws the exception below.
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
Usually, there is a Config.prc file in the etc subdirectory of the panda3d site-package directory. This file is non-existent in the packaged version. But if I create this subdirectory there, and copy the files to it as well, it still doesn't work and it still throws the same exception. There is a line "loadPrcData("win-size 1080 1920")" in my main program as well. Could this be part of the problem in any way? Or is there something else i am missing?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过包括整个Panda3D Lib解决了这个问题:
pyinstaller -add -data =“ path/to/panda3d; panda3d; panda3d” -wf main.py
I solved this problem by including the whole panda3d lib:
pyinstaller --add-data="path/to/panda3d;panda3d" -wF main.py
接受的答案增加了所有的二进制文件,这可以使创建的可执行文件的大小有些沉重。相反,只需添加所需的文件即可。在您的.spec文件中
分析
add:etc
文件夹由配置PRC文件组成,而.so二进制文件足以用于默认的图形管道和默认配置中的图形管道需要音频文件以确保工作正常。如果您想通过命令行进行工作,该命令行也可以使用-add-data和-add-binary完成。
The accepted answer adds all the binaries, which can make the size of the created executable a little heavy. Instead just the required files can be added. In your .spec file in
Analysis
add:The
etc
folder consists of the config prc files, while the .so binaries are enough for the graphics pipeline in the default config and the audio file is required to ensure that works fine.If you want to work through command line that can also be done using --add-data and --add-binary.