I have 2 versions of python installed, but cmake is using older version. How do I force cmake to use the newer version?

前端 未结 5 1650
再見小時候
再見小時候 2020-11-29 01:10

I have 2 versions of python installed, but cmake is using older version. How do I force cmake to use the newer version?

5条回答
  •  遥遥无期
    2020-11-29 01:48

    You may try either of these depending on what you need:

    For CMake >= 3.12

    According to the changelog:

    New "FindPython3" and "FindPython2" modules, as well as a new
    "FindPython" module, have been added to provide a new way to locate
    python environments.

    find_package(Python COMPONENTS Interpreter Development)
    

    Docs:

    This module looks preferably for version 3 of Python. If not found, version 2 is searched. To manage concurrent versions 3 and 2 of Python, use FindPython3 and FindPython2 modules rather than this one.

    For CMake < 3.12

    Docs:

    find_package(PythonInterp 2.7 REQUIRED)
    find_package(PythonLibs 2.7 REQUIRED)
    

提交回复
热议问题