【问题标题】:CMAKE is looking for python on the wrong folderCMAKE 在错误的文件夹中寻找 python
【发布时间】:2020-03-06 04:40:17
【问题描述】:

我正在尝试将 blender 构建为 python 模块 ( make bpy ),但出现此错误

Configuring Blender in "/Volumes/2Tb/Projects/Blender/build_darwin_bpy" ...
loading initial cache file /Volumes/2Tb/Projects/Blender/blender/build_files/cmake/config/bpy_module.cmake
-- Detected OS X 10.15 and Xcode 11. at /Applications/Xcode.app
-- OSX_SYSROOT_PREFIX: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
CMake Error at build_files/cmake/platform/platform_apple.cmake:124 (message):
  Python executable missing:
  /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
Call Stack (most recent call first):
  CMakeLists.txt:817 (include)


-- Configuring incomplete, errors occurred!
See also "/Users/queen/Projects/Blender/build_darwin_bpy/CMakeFiles/CMakeOutput.log".
make: *** [all] Error 1

它似乎在错误的目录中寻找 python,因为我的是由 homebrew 安装在 /user/local/ 上的

如何更改路径?我在.bash_profile 上尝试过:export PYTHONPATH=/user/local/bin,但没有成功。

谢谢

【问题讨论】:

标签: python cmake homebrew


【解决方案1】:

假设您正在使用最后一个 FindPython 模块。

查看提示部分

Python_ROOT_DIR 定义 Python 安装的根目录

src:https://cmake.org/cmake/help/git-stage/module/FindPython.html#hints

【讨论】:

  • 我找不到在哪里改变它(对不起,我是一个 cmake 菜鸟)
  • @Badjano 在您运行 configure cmake 时通过它:cmake -S. -Bbuild -DPython_ROOT_DIR=<path_to_python>
  • 我需要使用“make bpy”来构建,因为我想构建 python 模块,但是当我尝试“make bpy -DPython_ROOT_DIR=/usr/local/bin”时它给了我无效的选项跨度>
  • 我放弃了尝试查找 var 并对其进行更改,从我的文件夹创建了一个符号链接到他正在寻找的文件夹并且它有效,但现在构建由于另一个原因而崩溃
  • 这个项目不使用find_package(Python)。脚本build_files/cmake/platform/platform_apple.cmake 执行set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")。换句话说,它只期望 python 处于预定义的路径。除了将 python 可执行文件(或指向它的符号链接)放入此路径之外,我没有看到其他方法。
【解决方案2】:

我最终做了一个符号链接

ln -s origin_path destination_path

Python.framework 和它的工作

【讨论】:

  • 同样的问题。能给新手一些终端指令吗?
  • 它就在那里,只需将 origin_path 和 destination_path 替换为您拥有的那些
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-03-31
  • 2012-04-25
  • 1970-01-01
  • 2016-12-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多