我通过pip install stockfish
安装了一个名为stockfish的库。
所以我继续尝试通过以下方式设置Stockfish:
from stockfish import Stockfish
stockfish = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win')
这将引发WinError 5,访问被拒绝:
Exception ignored in: <function Stockfish.__del__ at 0x0429AA48>
Traceback (most recent call last):
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 270, in __del__
self.stockfish.kill()
AttributeError: 'Stockfish' object has no attribute 'stockfish'
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
emily = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win\src')
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 33, in __init__
self.stockfish = subprocess.Popen(
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Zugriff verweigert
我做了/尝试过什么?
我尝试了不同的Stockfish下载,以管理员身份运行Idle或CMD,重新安装并使用了不同的PC,但是我不知怎么不能与Stockfish一起工作-有人能够帮助我绕过拒绝访问吗?初始化时我会错过什么?尝试Stockfish
会返回<class 'stockfish.models.Stockfish'>
,因此似乎已正确导入并可以正常工作。