You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows系统PyCharm 2023.3.5无法安装第三方包求助

SSL证书验证失败导致PyCharm无法安装第三方包(pandas、openpyxl等)

环境信息

  • 系统:Windows 64位
  • Python版本:3.11.0
  • PyCharm版本:Community Edition 2023.3.5

报错信息

无法获取URL https://pypi.org/simple/openpyxl/: 确认SSL证书时出现问题: HTTPSConnectionPool(host='pypi.org', port=443): 对URL /simple/openpyxl/ 的重试次数已达上限 (由SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)')) 引起) - 跳过
无法获取URL https://pypi.org/simple/pip/: 确认SSL证书时出现问题: HTTPSConnectionPool(host='pypi.org', port=443): 对URL /simple/pip/ 的重试次数已达上限 (由SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)')) 引起) - 跳过
警告: 连接被 'SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)'))' 中断后重试 (Retry(total=4, connect=None, read=None, redirect=None, status=None)): /simple/openpyxl/
警告: 连接被 'SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)'))' 中断后重试 (Retry(total=3, connect=None, read=None, redirect=None, status=None)): /simple/openpyxl/
警告: 连接被 'SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)'))' 中断后重试 (Retry(total=2, connect=None, read=None, redirect=None, status=None)): /simple/openpyxl/
警告: 连接被 'SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)'))' 中断后重试 (Retry(total=1, connect=None, read=None, redirect=None, status=None)): /simple/openpyxl/
警告: 连接被 'SSLError(SSLCertVerificationError(1, '[SSL: 证书验证失败] 证书验证失败: 无法获取本地颁发者证书 (_ssl.c:992)'))' 中断后重试 (Retry(total=0, connect=None, read=None, redirect=None, status=None)): /simple/openpyxl/
错误: 找不到满足要求 openpyxl==3.2.0b1 的版本 (可用版本: 无)
错误: 没有找到匹配 openpyxl==3.2.0b1 的发行版

解决方案

方法1:安装时指定国内镜像源

在PyCharm包安装界面添加国内镜像参数:

  1. 打开File > Settings > Project: [你的项目名] > Python Interpreter
  2. 点击右上角+号,搜索目标包(如openpyxl)
  3. 在Install Package窗口的Options输入框中填入:
    -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
    
  4. 点击Install Package完成安装

方法2:配置全局pip镜像源

  1. 在Windows用户目录(如C:\Users\你的用户名)新建pip文件夹
  2. 文件夹内创建pip.ini文件,写入以下内容:
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    trusted-host = pypi.tuna.tsinghua.edu.cn
    
  3. 重启PyCharm后重新尝试安装包

方法3:更换稳定版包安装

报错提示找不到openpyxl==3.2.0b1(beta测试版),可直接搜索openpyxl安装最新稳定版,避免指定测试版本导致的匹配失败。

方法4:更新系统SSL证书

  1. 下载最新的根证书文件
  2. 找到Python安装目录下的Lib\site-packages\certifi文件夹,替换其中的cacert.pem文件为新证书
  3. 重启PyCharm后重试安装

内容的提问来源于stack exchange,提问作者RXXX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 00:06:03