2017-01-06 153 views
0

我是Python和Pyglet的新手。我剛剛在我的Linux和Window7上安裝了Pyglet。我跑在我的Linux一個非常簡單的測試文件,我得到了錯誤Python3和Pyglet - 需要幫助

(在Linux上:Python的3.5.2 Pyglet 1.2.4)

以下是測試file-tests.py:

import pyglet 

window = pyglet.window.Window() 
pyglet.app.run() 

我得到了下面的錯誤,當我在我的Linux運行它:

Traceback (most recent call last): 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 351, in getattr return getattr(self._module, name) 

AttributeError: 'NoneType' object has no attribute 'Window' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): File "test.py", line 6, in <module> window = pyglet.window.Window() File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 357, in getattr import(import_name) 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 1816, in <module> gl._create_shadow_window() 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/gl/init.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 163, in init super(XlibWindow, self).init(args, *kwargs) 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 558, in init self._create() 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 353, in _create self.set_caption(self._caption) 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 513, in set_caption self._set_text_property('_NET_WM_NAME', caption) 

File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 783, in _set_text_property raise XlibException('Could not create UTF8 text property') 

pyglet.window.xlib.XlibException: Could not create UTF8 text property* 

這個測試文件,工程確定對我的Win7

(在Window7上:Python 3.6.0 Pyglet 1.2.4)

請幫助,如果你知道爲什麼。謝謝。

+0

安裝'pyglet'時是否有錯誤信息?這有一個失敗的安裝標記。 –

+0

我用:PIP3安裝pyglet:我: 「安裝包收集:pyglet 成功安裝pyglet-1.2.4」 – anch0ret

+0

@ anch0ret'須藤PIP安裝pyglet' – Torxed

回答

1

正如我們從上面的評論中看出的那樣,它看起來像是安裝輸出打印了一些奇怪的符號。這一點以及pyglet加載UTF-8上下文的問題讓我相信在操作系統中沒有UTF-8支持。

通常,您可以在/etc/locale.conf中取消註釋en_US.UTF-8並運行locale-gen並且應該解決問題。

+0

它解決了我的問題。 – anch0ret