conan2 基础入门(02)-安装

conan2 基础入门(02)-安装

⭐前言

Conan 2.0: C and C++ Open Source Package Manager

官方提供三种安装conan的方式。分别为:

  • Recommended install (need python in your system):
    • 使用python安装
  • Other Installers:
    • 安装包安装
  • Self-contained (no Python needed):
    • 自行操作

在这里插入图片描述

其中,python不是必须的,没有python不会影响后两种的安装方式和具体的conan使用。

但用python安装对后期学习和使用conanfile.py有一定的帮助和好处。

但作为初学阶段,只需要做到三选一即可

⭐安装

下面以windows x86_64平台为例来介绍安装。(大多数朋友的电脑也是这个选择)

注意,下文所有路径,尽量不要出现中文。

在这里插入图片描述

python安装

安装conan

使用python安装非常简单,只要直接使用pip install即可。

pip install conan

下面介绍一些其他的内容:

卸载conan

pip uninstall conan

Found existing installation: conan 2.2.3
Uninstalling conan-2.2.3:
  Would remove:
    d:\users\appdata\local\programs\python\python312\lib\site-packages\conan-2.2.3.dist-info\*
    d:\users\appdata\local\programs\python\python312\lib\site-packages\conan\*
    d:\users\appdata\local\programs\python\python312\lib\site-packages\conans\*
    d:\users\appdata\local\programs\python\python312\scripts\conan.exe
Proceed (Y/n)? y
  Successfully uninstalled conan-2.2.3

查看conan版本

需要查看conan版本,需要先安装python的查找工具pip-search

注意包名是中划线,命令是下划线。

# 安装pip-search
pip install pip-search
# 查找conan
pip_search conan

这个工具搜索出来的结果的格式化非常好看。

在这里插入图片描述

安装指定版本conan

可以根据官方或者命令行查找出的内容,安装指定的conan版本。

# 指定安装2.2.3版本
# 使用清华源
pip install conan==2.2.3 -i https://pypi.tuna.tsinghua.edu.cn/simple

安装包安装

双击conan-2.2.3-windows-x86_64-installer.exe

不需要动脑子,直接一路Next,最终Install即可。

其中图2是自定义安装目录,图4是的单项选择的后两个是自动帮助配置环境变量。

在这里插入图片描述

自行操作

直接解压conan-2.2.3-windows-x86_64.zip即可。

解压后非常干净,就一个文件夹和一个conan.exe可执行文件。当不需要了直接把这些放进回收站即可。

在这里插入图片描述

⭐验证

配置环境变量

快速打开环境变量配置,命令行输入sysdm.cpl

sysdm.cpl

高级 -> 环境变量

在这里插入图片描述

自行选择要配置到用户环境还是系统环境,两者均可。

这个字符串就是conan.exe该文件的所在目录。

如果是用python安装的,请确保pip的下载目录也是配好的。一般来说也就是我下图中的Python312\Scripts

在这里插入图片描述

命令行验证

在命令行输入conan即可。

每个下级的指令可以通过--help来查看。

conan
Consumer commands
list       List existing recipes, revisions, or packages in the cache (by default) or the
             remotes.
remove     Remove recipes or packages from local cache or a remote.
cache      Perform file operations in the local cache (of recipes and/or packages).
install    Install the requirements specified in a recipe (conanfile.py or conanfile.txt).
remote     Manage the remote list and the users authenticated on them.
profile    Manage profiles.
graph      Compute a dependency graph, without installing or building the binaries.
version    Give information about the Conan client version.
inspect    Inspect a conanfile.py to return its public fields.
lock       Create or manage lockfiles.
search     Search for package recipes in all the remotes (by default), or a remote.
config     Manage the Conan configuration in the Conan home.

Creator commands
export-pkg Create a package directly from pre-compiled binaries.
build      Install dependencies and call the build() method.
create     Create a package.
export     Export a recipe to the Conan package cache.
download   Download (without installing) a single conan package from a remote server.
test       Test a package from a test_package folder.
source     Call the source() method.
upload     Upload packages to a remote.
editable   Allow working with a package that resides in user folder.
new        Create a new example recipe and source files from a template.

Type "conan <command> -h" for help

在这里插入图片描述

conan配置文件

当验证完conan后,conan会自动在电脑中生成对应的配置文件和临时文件。

conan config home
# 一般windows会在该目录下
C:\Users\{用户名}\.conan2

此处下图中的用户名=lotus

在这里插入图片描述

在这里插入图片描述




END

关注我,学习更多C/C++,算法,计算机知识

B站:

👨‍💻主页:天赐细莲 bilibili

相关推荐

  1. Conan2: Conceptions & Configurations & Command Lines

    2024-05-11 23:14:08       46 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-11 23:14:08       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-11 23:14:08       106 阅读
  3. 在Django里面运行非项目文件

    2024-05-11 23:14:08       87 阅读
  4. Python语言-面向对象

    2024-05-11 23:14:08       96 阅读

热门阅读

  1. QT_BEGIN_NAMESPACE

    2024-05-11 23:14:08       34 阅读
  2. TypeScript的`undefined`作用与使用:初学者指南

    2024-05-11 23:14:08       38 阅读
  3. Redhat Linux忘记密码解决方案

    2024-05-11 23:14:08       34 阅读
  4. 第 8 章 机器人底盘Arduino端入口(自学二刷笔记)

    2024-05-11 23:14:08       28 阅读
  5. 研究生写论文常用工具以及如何快速阅读外文

    2024-05-11 23:14:08       34 阅读
  6. 接口测试的流程

    2024-05-11 23:14:08       30 阅读
  7. LeetCode刷题笔记第217题:存在重复元素

    2024-05-11 23:14:08       31 阅读
  8. c++数据结构-图(详解附算法代码,一看就懂)

    2024-05-11 23:14:08       39 阅读