![无法在安装了 Anaconda 的机器上运行 Arcade](https://linux22.com/image/1586233/%E6%97%A0%E6%B3%95%E5%9C%A8%E5%AE%89%E8%A3%85%E4%BA%86%20Anaconda%20%E7%9A%84%E6%9C%BA%E5%99%A8%E4%B8%8A%E8%BF%90%E8%A1%8C%20Arcade.png)
我是编程课程的助教。本周的挑战是构建一个基本的国际象棋游戏。老师创建了一个game.py
可以帮助他们的库。问题是,当使用LostGame
定义如下(并使用库Arcade
)的类时:
class LostGame(arcade.Window):
def __init__(self):
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
self.sprites_list = None
self.background = None
arcade.set_background_color(arcade.color.RED)
self.moves = []
self.doing = 0
self.started = 0
self.current_text = "Comienza el juego"
我们将会出现以下错误:
Traceback (most recent call last):
File "test.py", line 4, in <module>
juego = game.LostGame()
File "/Users/daniel/Documents/Doctorado/Ayudantías/IIC2115/L02/game.py", line 39, in __init__
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/arcade/application.py", line 53, in __init__
resizable=resizable, config=config)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyglet/window/__init__.py", line 643, in __init__
self._create()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/arcade/monkey_patch_pyglet.py", line 81, in _create
self.context.attach(self.canvas)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyglet/gl/cocoa.py", line 289, in attach
self._nscontext.setView_(canvas.nsview)
AttributeError: 'NoneType' object has no attribute 'setView_'
我们注意到这个错误会发生在所有安装了 Anaconda 的计算机上。我们认为这可能是因为 Anaconda 的 Python 无法识别该Arcade
库。我们已经在 的独立版本上运行了代码Python 3.7
,但没有成功。
在此先感谢您的帮助!