1

pyinstaller random_move_chessbot.py --onefile你好,我在 virtualenv 中用 python 制作了一个国际象棋机器人,我的机器人使用祝福来为它使用 pyinstaller 显示的棋盘blessed\terminal.py:186: UserWarning: Failed to setupterm(kind='vtwin10'): Could not find terminal vtwin10上色 谁能告诉我为什么会这样?
提前致谢...

from random import *
import chess
import blessed

board = chess.Board()
term = blessed.Terminal()
run = True

print('Your playing white')

def blackmove():
    black_moves = board.legal_moves
    black_moves = list(black_moves)
    bmove = randint(0, len(black_moves))
    black_move = black_moves[bmove]
    board.push(black_move)

print('To exit write "exit"')
while run:
    white_move = input('Enter Move:')
    if white_move == 'exit':
        run = False
        exit()
    board.push_san(white_move)
    print(term.yellow("White's Turn"))
    if board.is_check == True:
        print(f'{term.red}{board}{term.normal}')
    else:
        print(f'{term.blue}{board}{term.normal}')
    blackmove()
    print(term.yellow("Black's Turn"))
    if board.is_check == True:
        print(f'{term.red}{board}{term.normal}')
    else:
        print(f'{term.green}{board}{term.normal}')
    if board.is_checkmate == True or board.is_stalemate == True:
        run = False
        print(board)
        print(board.result)
        exit = False
        while exit != True:
            a = input('Exit[y/n]:')
            match a:
                case 'y':
                    exit = True
                case 'n':
                    pass
4

1 回答 1

0

看起来我找到了解决方法;
您必须输入此命令,以便将 vtwin10 终端导入 jinx 库中 pyinstaller --hidden-import=jinxed.terminfo.vtwin10 --onefile test.py

于 2021-11-17T12:27:49.100 回答