Conan安装第三方依赖库时SSL验证失败解决办法

背景

c++跨平台项目使用conan进行三方库依赖管理是比较通用的方案,更换开发环境后突然发现conan无法安装三方库了,报错如下:

复制代码
zlib/1.2.12: Not found in local cache, looking in remotes...
zlib/1.2.12: Trying with 'conan-center'...
ERROR: Failed requirement 'zlib/1.2.12' from 'conanfile.py (QtConanExample/None)'
ERROR: HTTPSConnectionPool(host='center.conan.io', port=443): Max retries exceeded with url: /v1/ping (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

Unable to connect to conan-center=https://center.conan.io
1. Make sure the remote is reachable or,
2. Disable it by using conan remote disable,
Then try again.
CMake Error at build/conan.cmake:651 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  CMakeLists.txt:199 (conan_cmake_install)


-- Configuring incomplete, errors occurred!

字面意思就是SSL证书验证失败了。

解决办法

删除~/.conan/cacert.pem, 然后重试即可。

相关推荐
一只鲲20 分钟前
48 C++ STL模板库17-容器9-关联容器-映射(map)多重映射(multimap)
开发语言·c++
智践行1 小时前
C++11 智能指针:`std::unique_ptr`、`std::shared_ptr`和`std::weak_ptr`
c++
智践行1 小时前
C++11之后的 Lambda 表达式 以及 `std::function`和`std::bind`
c++
智践行1 小时前
C++11移动语义‘偷梁换柱’实战
c++
祁同伟.2 小时前
【C++】模版(初阶)
c++
sTone873753 小时前
android studio之外使用NDK编译生成android指定架构的动态库
android·c++
卷卷卷土重来4 小时前
C++单例模式
javascript·c++·单例模式
yuyanjingtao4 小时前
CCF-GESP 等级考试 2025年6月认证C++二级真题解析
c++·青少年编程·gesp·csp-j/s
long_run6 小时前
C++之auto 关键字
c++
疯狂的代M夫6 小时前
C++对象的内存布局
开发语言·c++