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

Windows10下Anaconda与Jupyter Notebook的SSL模块加载故障求助

Anaconda3(Python3.9)Windows10下ssl模块加载失败问题

问题背景

在Windows10系统使用64位最新版Anaconda3(Python3.9)时,程序无法正常运行,核心为ssl模块无法加载。已尝试以下方案但无效:

  • 将Anaconda3、Anaconda3\bin、Anaconda3\Lib、Anaconda3\pkgs\openssl-1.1.1n-h2bbff1b_0\Library\bin添加至PATH环境变量
  • 确认系统中存在libssl-1_1-x64.dll文件

错误现象

  1. Anaconda Navigator与Jupyter Notebook启动失败:启动脚本无任何反应,直接退出,无报错信息
  2. import ssl报错:
    在Python命令提示符执行import ssl时,先弹出以下提示:
    'MySQL' is not recognized as an internal or external command,
    operable program or batch file.
    'MySQL' is not recognized as an internal or external command,
    operable program or batch file.
    
    随后抛出ImportError:
    (base) C:\Users\kadambi>python
    Python 3.9.12 (main, Apr  4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
    Type "help", "copyright", "credits" or "license" for more information.
    
    >>> import ssl
    Traceback (most recent call last):
    File "", line 1, in 
    File "C:\Software\Anaconda3\lib\ssl.py", line 98, in 
    import _ssl             # if we can't import it, let the error propagate
    ImportError: DLL load failed while importing _ssl: The specified procedure could not be found.
    
  3. pip install pyopenssl报错:
    (base) C:\Users\kadambi>pip install pyopenssl
    Defaulting to user installation because normal site-packages is not writeable
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Requirement already satisfied: pyopenssl in c:\software\anaconda3\lib\site-packages (21.0.0)
    Requirement already satisfied: six>=1.5.2 in c:\software\anaconda3\lib\site-packages (from pyopenssl) (1.16.0)
    Requirement already satisfied: cryptography>=3.3 in c:\software\anaconda3\lib\site-packages (from pyopenssl) (3.4.8)
    Requirement already satisfied: cffi>=1.12 in c:\software\anaconda3\lib\site-packages (from cryptography>=3.3->pyopenssl) (1.15.0)
    Requirement already satisfied: pycparser in c:\software\anaconda3\lib\site-packages (from cffi>=1.12->cryptography>=3.3->pyopenssl) (2.21)
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
    
    (base) C:\Users\kadambi>
    

解决方案

  • 排查OpenSSL版本冲突
    1. 打开命令提示符,执行where libssl-1_1-x64.dll,查看返回的所有路径
    2. 如果存在非Anaconda路径的同名文件,将Anaconda3\pkgs\openssl-1.1.1n-h2bbff1b_0\Library\bin移至PATH环境变量的最顶端,确保优先加载Anaconda自带的DLL
  • 强制修复Anaconda的OpenSSL依赖
    1. 以管理员身份启动Anaconda Prompt
    2. 执行conda install -c anaconda openssl --force-reinstall,重新安装对应版本的OpenSSL
  • 检查并修复_ssl.pyd文件
    1. 前往C:\Software\Anaconda3\DLLs目录,确认_ssl.pyd文件存在且未损坏
    2. 若文件缺失或损坏,重新运行Anaconda安装程序,选择「修复」选项
  • 调整PATH环境变量优先级
    将所有Anaconda相关路径(Anaconda3、Anaconda3\bin、Anaconda3\pkgs\openssl-xxx\Library\bin)移至PATH环境变量的最前面,避免系统加载其他软件的同名DLL

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 17:24:27