我安装了 2 个版本的 python,但是cmake正在使用旧版本。我该如何强迫cmake使用较新的版本?
您可以根据需要尝试以下任一方法:
For CMake >= 3.12
根据变更日志:
新的“FindPython3”和“FindPython2”模块,以及新的
添加了“FindPython”模块,提供了一种新的定位方式
python 环境。
find_package(Python COMPONENTS Interpreter Development)
Docs https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython:
该模块更适合 Python 3 版本。如果没有找到,
搜索版本 2。管理并发版本 3 和 2
Python,使用 FindPython3 和 FindPython2 模块而不是这个模块。
For CMake < 3.12
Docs https://cmake.org/cmake/help/v3.12/module/FindPythonInterp.html:
find_package(PythonInterp 2.7 REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)