即使设置了 Brew 安装也找不到 PythonInterp

Brew installation does not find PythonInterp even when set

我正在尝试通过 Brew 在 Mac OS 12.4 上安装 Sumo。我以前用过它,但最近卸载了它,现在它似乎不喜欢安装了。

当我运行brew install sumo时,输出如下:

Last 15 lines from /Users/behradkoohy/Library/Logs/Homebrew/sumo/01.cmake:
--     CMake: 3.23.1
--     CMake generator: Unix Makefiles
--     CMake build tool: /opt/homebrew/Library/Homebrew/shims/mac/super/gmake
--     Compiler: Clang 13.1.6.13160021
--
CMake Error at /opt/homebrew/Cellar/cmake/3.23.1_1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.23.1_1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.23.1_1/share/cmake/Modules/FindPythonInterp.cmake:169 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:170 (find_package)


-- Configuring incomplete, errors occurred!
See also "/tmp/sumo-20220526-41647-p2rgj7/sumo-1.13.0/build/cmake-build/CMakeFiles/CMakeOutput.log".

我试过手动定义 PythonInterp/PYTHON_EXECUTABLE,但这似乎并没有消除错误。此外,当我在 Whosebug 上搜索类似问题时,它们通常都与 Make 有关 - 我不确定通过 brew 安装时如何编辑。

如有任何帮助,我们将不胜感激。我试过卸载并重新安装 Brew 也无济于事。

虽然不理想,但找到了解决方案,如下所示:

首先我运行brew edit sumo看看我运行brew install sumo.

执行了什么

在文件中间的某处,有 cmake_args 的定义。我为此添加了 "-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3"。进行此更改后,安装程序不再抱怨找不到 Python_Interp.