这是一个更大项目的一部分,但我创建了一个新文件来解决这个问题。对不起,我还是编码新手。目前,我正在尝试对国际象棋中的位置进行鱼评估,但是每当我尝试运行代码时,我都会得到“AttributeError:模块'chess.engine'没有属性'SimpleEngine'”我已经查看了互联网并且可以'什么都找不到,我是不是很笨?我也尝试了文档中的代码,但仍然遇到相同的错误。这是文档中的代码:
!pip install python-chess
!pip install stockfish
import chess
import chess.engine
from stockfish import Stockfish
import asyncio
engine = chess.engine.SimpleEngine.popen_uci("stockfish")
board = chess.Board()
while not board.is_game_over():
result = engine.play(board, chess.engine.Limit(time=0.100))
board.push(result.move)
engine.quit()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-36-5ab68cc48dde> in <module>()
4 import asyncio
5
----> 6 engine = chess.engine.SimpleEngine.popen_uci("stockfish")
7
8 board = chess.Board()
AttributeError: module 'chess.engine' has no attribute 'SimpleEngine'