ImportError: DLL load failed while importing _ssl: 找不到指定的模块。

windonw cmd下的输出:

复制代码
(python3.9) PS D:\git\ImageAnalysisService\core\medical_bills> python
Python 3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import exceptiongroup
>>> import anyio
>>> import ssl
>>> import _ssl
>>> print(ssl)
<module 'ssl' from 'D:\\conda\\envs\\python3.9\\lib\\ssl.py'>
>>> print(_ssl)
<module '_ssl' from 'D:\\conda\\envs\\python3.9\\DLLs\\_ssl.pyd'>
>>>

pycharm下的输出:

复制代码
D:\git\ImageAnalysisService\venv\Scripts\python.exe D:\git\ImageAnalysisService\core\medical_bills\analysis_system.py 
Traceback (most recent call last):
  File "D:\git\ImageAnalysisService\core\medical_bills\analysis_system.py", line 10, in <module>
    import ssl
  File "D:\conda\envs\python3.9\lib\ssl.py", line 99, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed while importing _ssl: 找不到指定的模块。

环境相同,都是同一个虚拟环境的,怎么不同地方会有问题呢?

环境中分明是有这个包的,但是就是找不到,看这个_ssl包的路径和ssl包路径不同,猜想是可以copy一份到DLL路径中或者是lib路径中;

结合博客中https://blog.csdn.net/LeiChennb/article/details/134586416的说法:

因为缺少DLL,但是博客中是在conda上操作,我想,应该在conda env中操作,对虚拟环境进行操作;

如此操作:

将

"D:\conda\envs\python3.9\Library\bin\libcrypto-3-x64.dll"

"D:\conda\envs\python3.9\Library\bin\libssl-3-x64.dll"

复制到:

"D:\conda\envs\python3.9\DLLs"

果然就解决了问题;

相关推荐
終不似少年遊*5 分钟前
【Skill】为中型研发团队制作的敏捷迭代AI副驾Skill
人工智能·python·华为云·agent·ai编程·skill
呆萌的代Ma7 分钟前
python使用ThreadPoolExecutor自带队列将多线程变串行执行
python
echome88813 分钟前
Python 正则表达式:5 个日常够用的模式
python·正则表达式
吴名氏.35 分钟前
Java转AI Agent教程(第二周)超时重试与错误分类
java·人工智能·python·分类·ai agent
青少儿编程课堂37 分钟前
2026蓝桥杯·全国青少年信息素养大赛·电子学会Python/C++考级:堆排序与优先队列解析
c++·python·算法·bfs·信息学竞赛
Eiceblue38 分钟前
用 Python 给 Word 文档加水印:文字、图片与批量处理
开发语言·vscode·python·word
Android小码家1 小时前
framework&framework-minus-apex&android.jar的区别
android·python·jar
lee_curry1 小时前
第十周完整学习笔记:继续升级为“检索更准、权限安全、索引可维护、失败可恢复、长期可运行”的企业级 RAG 系统
python·ai·langchain·agent·langgraph
Ivanqhz2 小时前
MoE + LLM 应用
数据库·人工智能·pytorch·python·深度学习·算法·1024程序员节
Mr. zhihao2 小时前
Deep Agent 架构深度解析:主Agent与子Agent完整交互机制与核心参数作用
python·ai·langgraph·deepagent