AttributeError with Pyglet

匆匆过客 提交于 2019-12-08 12:41:53

问题


I'm literally starting in Pyglet, and I tried the simplest program with it (A hello world window).

import pyglet

window = pyglet.window.Window(width=640, height=480, caption="Hola Mundo!")
pyglet.app.run()

But when I run it, I get an AttributeError:

AttributeError: 'module' has no attribute 'window'

回答1:


It is likely that you have a file in the cwd called pyglet. When importing modules, python first looks at the cwd before looking in the global list of installed packages.

Rename that file and delete the corresponding pyglet.pyc file.

Posting the information from bernie in an answer since it is likely correct. Trying to reduce the unanswered question queue.



来源:https://stackoverflow.com/questions/38442628/attributeerror-with-pyglet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!