无论我尝试什么,为什么这个路径问题都会发生

问题描述 投票:0回答:0

在尝试测试程序时,我一直遇到在 MacOS 中运行命令的路径问题。我已经尝试过使用 VSCode 和直接从终端。在 VENV 中和不在 VENV 中。我终于能够通过使用绝对路径无法访问文件本身,但随后遇到了资产本身的路径问题。这个:

(base) thisaintyocompgetoff@nonyas-MacBook-Air pkmn_chs % python "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py" 

返回这个:

Traceback (most recent call last):
  File "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 3578, in <module>
    main()
  File "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 3574, in main
    pecg.main_loop()
  File "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 2579, in main_loop
    self.check_engine_config_file()
  File "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 1163, in check_engine_config_file
    self.engine_file_list = self.get_engines()
  File "/Users/thisaintyocompgetoff/Desktop/Coding/pkmn_chs/chess_env/lib/python3.9/site-packages/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 2412, in get_engines
    files = os.listdir(engine_path)
FileNotFoundError: [Errno 2] No such file or directory: 'Engines'

我在棋盘上的图片上遇到了类似的错误。

有没有办法在不手动将每条路径更改为其绝对路径的情况下解决此问题?我想在此基础上构建,这样看起来它会在项目开始之前停止它。

我在 MacOS Monterrey 12.6.2

python macos user-interface chess python-chess
© www.soinside.com 2019 - 2024. All rights reserved.