【问题标题】:Pyinstaller opens Stockfish in consolePyinstaller 在控制台中打开 Stockfish
【发布时间】:2022-01-17 15:48:10
【问题描述】:

我制作了一个 GUI(使用 PySimpleGUI),您可以在其中与 Stockfish 对战(我使用了 python-chess 模块)。我使用 Pyinstaller --noconsole 创建了一个 .exe 文件,但是当我运行它时,它会在控制台中打开 Stockfish。当我从源代码运行它时,在 PyCharm 中,Stockfish 在后台静默运行。

相关的代码行是(我猜):

engine = chess.engine.SimpleEngine.popen_uci(engine_filename, shell = False)

稍后,

best_move = engine.play(board, chess.engine.Limit(depth=20)).move

关于如何让 Stockfish 在后台静默运行的任何建议也形成 .exe 文件?

【问题讨论】:

    标签: pyinstaller stockfish


    【解决方案1】:

    如下定义您的引擎。

    import subprocess
    
    engine = chess.engine.SimpleEngine.popen_uci(
                engine_filename,
                shell = False,
                creationflags=subprocess.CREATE_NO_WINDOW)
    

    python subprocess ref.

    【讨论】:

      猜你喜欢
      • 2021-09-26
      • 2016-12-08
      • 1970-01-01
      • 2016-05-08
      • 2020-03-26
      • 2021-09-22
      • 2015-05-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多