【问题标题】:Directory location for python 2 and 3python 2和3的目录位置
【发布时间】:2017-06-11 09:54:07
【问题描述】:

在我的usr/bin目录下,有3个python的可执行文件——python、python27、python36

python文件指向哪个版本的python? 我应该将什么参数传递给 cmake find_program 以获取 python 3 版本?

【问题讨论】:

  • 那么python --version 告诉你什么?
  • ls -Al 是你的朋友。它将显示python 的链接。
  • python --version 显示 2.7 但 whereis python 显示 python2.7 和 python3.5 和 python 文件。

标签: python linux cmake


【解决方案1】:

我应该将什么参数传递给 cmake find_program 以获取 python 3 版本? -

find_program通过文件名搜索可执行文件,所以你需要传递python36才能找到它。

但查找 python 可执行文件的首选方法是find_package(PythonInterp)。这样你就可以指定最低版本而不关心确切的文件名:

find_package(PythonInterp 3)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    • 2018-10-22
    • 1970-01-01
    相关资源
    最近更新 更多