简体   繁体   English

将windows上运行的程序移植到mac时如何替换可执行文件?

[英]How to replace the executable file when a program run on a windows is ported to mac?

The following code works fine on a PC, but how do I make it work on a mac?以下代码在 PC 上运行良好,但如何使其在 mac 上运行? The problem is how do I get the link to the stockfish executable on a mac?问题是如何在 Mac 上获取到 stockfish 可执行文件的链接? I'm having trouble porting the line three onto a mac (pycharm).我在将第三行移植到 mac (pycharm) 时遇到问题。 I have installed stockfish via brew but confused how I should write the line three equivalent on a mac.我已经通过 brew 安装了 stockfish,但对如何在 mac 上编写等效的第三行感到困惑。

import chess
import chess.engine

engine = chess.engine.SimpleEngine.popen_uci(r"C:\Users\xxxxx\Downloads\stockfish_14_win_x64\stockfish_14_win_x64_avx2.exe")

board = chess.Board()
while not board.is_game_over():
    result = engine.play(board, chess.engine.Limit(time=0.1))
    board.push(result.move)

engine.quit()

You should go in the Finder, and search any executable file named stockfish (using cmd+f).您应该在 Finder 中搜索 go,并搜索任何名为 stockfish 的可执行文件(使用 cmd+f)。 Next, just take the path of this file and replace it in your code.接下来,只需获取此文件的路径并在您的代码中替换它。 If you face an erno 13 permission denied, you will have to open the terminal app, and type chmod +x your_stockfish_path如果您遇到 erno 13 权限被拒绝,您必须打开终端应用程序,然后输入chmod +x your_stockfish_path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM