讲师中心 微信公众号
AI工具推荐 视频效率加速

How to Locate the CA Bundle Used by Pip

老磊君_7061

老磊君_7061

发布时间:2026-07-20 11:19:02

|

1033人浏览过

|

来源于php中文网

原创

How to Locate the CA Bundle Used by Pip

Pip uses its own bundled CA certificate store (from certifi) embedded in its _vendor package—not the system’s trust store—making it essential to know the exact path for debugging SSL issues or custom certificate injection.

pip uses its own bundled ca certificate store (from `certifi`) embedded in its `_vendor` package—not the system’s trust store—making it essential to know the exact path for debugging ssl issues or custom certificate injection.

Pip does not rely on the system’s certificate store (e.g., /etc/ssl/certs/ca-certificates.crt on Debian/Ubuntu or Keychain on macOS). Instead, it bundles a curated, up-to-date CA certificate bundle from the certifi project directly within its internal _vendor module. Even when certifi is not installed globally (as commonly seen in minimal Docker images like python:3.10), pip still works because it carries its own copy.

To locate the exact path of the CA bundle pip uses:

  1. First, find pip’s installation location:

    python -c "import pip; print(pip.__file__)"

    This typically points to something like /usr/local/lib/python3.10/site-packages/pip/__init__.py.

  2. Then derive the CA bundle path — it resides at:

    CI Tools Pipeline
    CI Tools Pipeline

    使用位于 ci-tools.xrow.de 的 CI Tools 组件目录构建和维护 GitLab CI/CD 流水线,适用于创建或修复 .gitlab-ci.yml 文件,选择合适的组件。

    下载
    <pip-site-packages-root>/pip/_vendor/certifi/cacert.pem

    For example:

    # In a standard Python 3.10 Docker container:
    $ python -c "import pip; import os; print(os.path.join(os.path.dirname(pip.__file__), '_vendor', 'certifi', 'cacert.pem'))"
    /usr/local/lib/python3.10/site-packages/pip/_vendor/certifi/cacert.pem

✅ You can verify the file exists and inspect it:

ls -l /usr/local/lib/python3.10/site-packages/pip/_vendor/certifi/cacert.pem
head -n 3 /usr/local/lib/python3.10/site-packages/pip/_vendor/certifi/cacert.pem

⚠️ Important notes:

  • This path is not configurable via environment variables like SSL_CERT_FILE for pip’s internal HTTPS calls — those are hardcoded to use the bundled cert. However, tools like requests (when used separately) will respect SSL_CERT_FILE or REQUESTS_CA_BUNDLE.
  • Modifying cacert.pem manually is not recommended, as it will be overwritten on pip upgrades. For enterprise environments requiring custom CAs, prefer using --trusted-host (insecure, avoid in production) or configure pip.conf with global.trusted-host only for internal indexes — better yet, inject your CA into the base image or use pip install --cert /path/to/your-bundle.pem.
  • To confirm which bundle pip is actively using at runtime, you can also inspect pip’s internal logic:
    python -c "from pip._vendor.certifi import where; print(where())"

    This works because pip vendors certifi and exposes where() — and returns the same cacert.pem path.

In summary: pip’s CA bundle lives inside its vendored certifi, and the canonical way to resolve it is via pip._vendor.certifi.where() — a reliable, cross-platform, version-resilient method.

热门AI工具

更多
PixPix
PixPix Hot

PixPix是一款面向电商视觉生产的AI商品图生成工具。

Loomy
Loomy Hot

一款AI工具,主要用于科大讯飞发布的桌面级 AI 助理,比 OpenClaw 更易用、更安全!,适合需要提升相关任务效率的用户。

AionClaw
AionClaw Hot

AionClaw是一款面向办公、创作和编程任务的AI桌面智能体。

PixTV
PixTV Hot

PixTV是一款面向AIGC内容创作的AI视频生成工具。

切问学术

切问学术是一款AI论文写作工具,复旦大学NLP团队推出的AI学术智能体。

DeepSeek

DeepSeek是一款面向对话、写作、编程和推理场景的AI大模型工具。

WorkBuddy

一款AI办公效率工具,主要用于腾讯云推出的AI原生桌面智能体工作台,适合需要提升相关任务效率的用户。

豆包大模型

豆包大模型是一款由字节跳动推出的企业级大语言模型服务平台。

火山引擎

火山引擎是一款面向企业的云计算与AI服务平台。

相关专题

更多
python打包成可执行文件
python打包成可执行文件

本专题为大家带来python打包成可执行文件相关的文章,大家可以免费的下载体验。

1631

2023.07.20

python能做什么
python能做什么

python能做的有:可用于开发基于控制台的应用程序、多媒体部分开发、用于开发基于Web的应用程序、使用python处理数据、系统编程等等。本专题为大家提供python相关的各种文章、以及下载和课程。

4004

2023.07.25

format在python中的用法
format在python中的用法

Python中的format是一种字符串格式化方法,用于将变量或值插入到字符串中的占位符位置。通过format方法,我们可以动态地构建字符串,使其包含不同值。php中文网给大家带来了相关的教程以及文章,欢迎大家前来阅读学习。

1629

2023.07.31

python教程
python教程

Python已成为一门网红语言,即使是在非编程开发者当中,也掀起了一股学习的热潮。本专题为大家带来python教程的相关文章,大家可以免费体验学习。

23117

2023.08.03

python环境变量的配置
python环境变量的配置

Python是一种流行的编程语言,被广泛用于软件开发、数据分析和科学计算等领域。在安装Python之后,我们需要配置环境变量,以便在任何位置都能够访问Python的可执行文件。php中文网给大家带来了相关的教程以及文章,欢迎大家前来学习阅读。

2827

2023.08.04

python eval
python eval

eval函数是Python中一个非常强大的函数,它可以将字符串作为Python代码进行执行,实现动态编程的效果。然而,由于其潜在的安全风险和性能问题,需要谨慎使用。php中文网给大家带来了相关的教程以及文章,欢迎大家前来学习阅读。

2867

2023.08.04

scratch和python区别
scratch和python区别

scratch和python的区别:1、scratch是一种专为初学者设计的图形化编程语言,python是一种文本编程语言;2、scratch使用的是基于积木的编程语法,python采用更加传统的文本编程语法等等。本专题为大家提供scratch和python相关的文章、下载、课程内容,供大家免费下载体验。

1123

2023.08.11

python合并两个列表
python合并两个列表

Python是一种强大的编程语言,具有许多方便的功能和工具。在Python中,有多种方法可以合并两个列表。php中文网给大家带来了相关的教程以及文章,欢迎大家前来学习阅读。

596

2023.08.10

LLVM自定义Pass怎么写
LLVM自定义Pass怎么写

本专题聚焦LLVM自定义Pass开发,整理Pass类结构、run()方法、PreservedAnalyses、CMake构建、插件注册、-load-pass-plugin加载和测试用例编写流程。

20

2026.09.30

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Conan 2 安装指南
Conan 2 安装指南

共0课时 | 0人学习

Python虚拟环境官方教程
Python虚拟环境官方教程

共0课时 | 0人学习

Python venv官方模块文档
Python venv官方模块文档

共0课时 | 0人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn