pyglet分割错误和其他错误

我正在尝试使用Python库pyglet加载图片的精灵。 最初的目的是与游戏有关,但我相信我已经将问题简化为一行代码。 在Python shell中,我导入pyglet,然后运行下面这行代码(或者其他的东西):

pyglet.image.load("image.png") 

Python退出,terminal输出:

 Segmentation fault (core dumped) 

有时它不会这样做,而是抛出

 Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/pyglet/__init__.py", line 351, in __getattr__ return getattr(self._module, name) AttributeError: 'NoneType' object has no attribute 'load' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.4/site-packages/pyglet/__init__.py", line 357, in __getattr__ __import__(import_name) File "/usr/lib/python3.4/site-packages/pyglet/image/__init__.py", line 145, in <module> from pyglet.gl import * File "/usr/lib/python3.4/site-packages/pyglet/gl/__init__.py", line 236, in <module> import pyglet.window File "/usr/lib/python3.4/site-packages/pyglet/window/__init__.py", line 1816, in <module> gl._create_shadow_window() File "/usr/lib/python3.4/site-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/usr/lib/python3.4/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__ super(XlibWindow, self).__init__(*args, **kwargs) File "/usr/lib/python3.4/site-packages/pyglet/window/__init__.py", line 515, in __init__ context = config.create_context(gl.current_context) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 186, in create_context return XlibContextARB(self, share) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 300, in __init__ super(XlibContext13, self).__init__(config, share) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 203, in __init__ raise gl.ContextException('Could not create GL context') pyglet.gl.ContextException: Could not create GL context 

要么

 Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/pyglet/__init__.py", line 351, in __getattr__ return getattr(self._module, name) AttributeError: 'NoneType' object has no attribute 'load' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.4/site-packages/pyglet/__init__.py", line 357, in __getattr__ __import__(import_name) File "/usr/lib/python3.4/site-packages/pyglet/image/__init__.py", line 145, in <module> from pyglet.gl import * File "/usr/lib/python3.4/site-packages/pyglet/gl/__init__.py", line 101, in <module> from pyglet.gl import gl_info ImportError: cannot import name 'gl_info' 

(我不确定它为什么在这两个之间交替)。

此外,

 pyglet.window.Window() 

也抛出exception

 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.4/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__ super(XlibWindow, self).__init__(*args, **kwargs) File "/usr/lib/python3.4/site-packages/pyglet/window/__init__.py", line 515, in __init__ context = config.create_context(gl.current_context) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 186, in create_context return XlibContextARB(self, share) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 300, in __init__ super(XlibContext13, self).__init__(config, share) File "/usr/lib/python3.4/site-packages/pyglet/gl/xlib.py", line 203, in __init__ raise gl.ContextException('Could not create GL context') pyglet.gl.ContextException: Could not create GL context 

当从shell运行。 有时它运行时从一个文件运行(它会运行,后续运行失败,然后最终运行另一个运行),如果我没有记错,它运行没有问题从一个Python程序冻结与cx_Freeze。

在Google上我还没有find比几岁还要新的东西。 我不太了解OpenGL; 目前我使用pyglet是因为它简化了构build应用程序。

我正在运行带有XFCE的64位Manjaro Linux,AMD CPU和AMD集成显卡(带有封闭的Catalyst驱动程序)。 我有Python 3.4.2和pyglet 1.2.0。

有任何想法吗?

现在(2016.10.30)这个问题是fixet。 关于它的网站开发现状报告。

Pyglet网站开发人员是一个图像加载器的例子: http : //www.pyglet.org/doc/programming_guide/image_viewer.html 。

在我的Archlinux系统(Linux alw 3.19.1-1-ARCH#1 SMP PREEMPT Sat Mar 7 20:59:30 CET 2015 x86_64 GNU / Linux)这个错误持续存在 – 核心转储与python-3,bat工作正常蟒蛇-2。 我使用的最新版本的pyglet – 1.2.2。

在MS-Win 8.1上,这个例子没有任何错误。 我认为问题是这个模块做错了。

我在开发网站上报告了这个错误https://bitbucket.org/pyglet/pyglet/issue/25/core-dumped-on-linux-64

现在,您只能使用PNG格式:

 ... from pyglet.image.codecs.png import PNGImageDecoder fname = 'pennant.png' img_pennant = pyglet.image.load(fname, decoder=PNGImageDecoder()) ... 

这个代码不是核心倾弃的。