0

我正在用 Stockfish 编写一个 lichess 机器人。第一行代码失败并显示多条错误消息:

Exception ignored in: <function Stockfish.__del__ at 0x000002501F877550>
Traceback (most recent call last):
  File "C:\Users\jcbri\AppData\Local\Programs\Python\Python39\lib\site-packages\stockfish\models.py", line 396, in __del__    self._put("quit")
  File "C:\Users\jcbri\AppData\Local\Programs\Python\Python39\lib\site-packages\stockfish\models.py", line 80, in _put    
    if not self.stockfish.stdin:
AttributeError: 'Stockfish' object has no attribute 'stockfish'

机器人在控制台中这样说:

2021-08-06 16:05:04,694: Backing off play_game(...) for 2.0s (FileNotFoundError: [WinError 2] The system cannot find the file specified)

我的代码:

from stockfish import Stockfish
fish = Stockfish("C:/Users/jcbri/Downloads/stockfish_14_win_x64_avx2/stockfish_14_win_x64_avx2/stockfish_14_win_x64_avx2.exe")

## My evaluation code

我正在使用 Windows 10 并安装了 Stockfish 模块。是否有一些我丢失的文件或代码片段?

4

1 回答 1

0

尝试使用“\”而不是“/”

from stockfish import Stockfish
fish = Stockfish("C:\\Users\\jcbri\\Downloads\\stockfish_14_win_x64_avx2\\tockfish_14_win_x64_avx2\\stockfish_14_win_x64_avx2.exe")
于 2021-08-30T19:15:16.767 回答