问题
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