conan version

注意

此功能处于预览状态。这意味着它非常不可能被移除,并且不太可能发生破坏性更改。维护者将尽最大努力不破坏它,并且仅在非常必要时才这样做。请参阅 Conan 稳定性 部分以获取更多信息。

$ conan version -h
usage: conan version [-h] [-v [V]] [-cc CORE_CONF] [-f FORMAT]
                     [--out-file OUT_FILE]

Give information about the Conan client version.

options:
  -h, --help            show this help message and exit
  -v [V]                Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
  -cc CORE_CONF, --core-conf CORE_CONF
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
  -f FORMAT, --format FORMAT
                        Select the output format: json
  --out-file OUT_FILE   Write the output of the command to the specified file
                        instead of stdout.

conan version 命令显示关于系统和 Python 环境的信息,包括 Conan 版本、Python 版本、系统平台、架构、发行版、CPU 等

  • version: Conan 版本。

  • conan_path: Conan 脚本的路径。

  • python: 包含关于 Python 环境信息的子字典,包括
    • version: 正在使用的 Python 版本。

    • sys_version: 完整的 Python 系统版本。

    • sys_executable: Python 可执行文件的路径。

    • is_frozen: 指示 Python 脚本是否作为冻结文件运行(例如,使用 py2exe 或 PyInstaller)。

    • architecture: Python 检测到的架构。

  • system: 包含关于操作系统信息的子字典,包括
    • version: 操作系统的版本。

    • platform: 系统的平台。

    • system: 操作系统的名称。

    • release: 操作系统的发行版本。

    • cpu: 关于系统 CPU 的信息。

$ conan version
version: 2.0.6
conan_path: /conan/venv/bin/conan
python
  version: 3.10.4
  sys_version: 3.10.4 (main, May 17 2022, 10:53:07) [Clang 13.1.6 (clang-1316.0.21.2.3)]
  sys_executable: /conan/venv/bin/python
  is_frozen: False
  architecture: arm64
system
  version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031
  platform: macOS-14.4.1-arm64-arm-64bit
  system: Darwin
  release: 23.4.0
  cpu: arm

conan version --format=json 返回 stdout 中的 JSON 输出格式(可以重定向到文件),结构如下

$ conan version --format=json
{
    "version": "2.0.6",
    "conan_path": "/Users/myUser/Documents/GitHub/conan/venv/bin/conan",
    "python": {
        "version": "3.10.4",
        "sys_version": "3.10.4 (main, May 17 2022, 10:53:07) [Clang 13.1.6 (clang-1316.0.21.2.3)]",
        "sys_executable": "/conan/venv/bin/python",
        "is_frozen": false,
        "architecture": "arm64"
    },
    "system": {
        "version": "Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031",
        "platform": "macOS-14.4.1-arm64-arm-64bit",
        "system": "Darwin",
        "release": "23.4.0",
        "cpu": "arm"
    }
}