【发布时间】:2021-12-12 03:41:22
【问题描述】:
我在 python 下国际象棋我遇到了这个错误
这是我的代码:
import chess.board
board=chess.Board()
board
完全错误:
Traceback (most recent call last):
File "chess.py", line 1, in <module>
import chess
File "D:\Websites\repoting\chess.py", line 3, in <module>
board=chess.Board()
AttributeError: module 'chess' has no attribute 'Board'
【问题讨论】:
-
我没有安装这个模块,但是docs 说正确的语法是
import chess然后board = chess.Board() -
您保存代码的文件是否命名为
chess.py?如果是这样,如果您更改此文件的名称,您会得到同样的错误吗? -
如果你发布这个答案我会选择你发布它
标签: python chess python-chess