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"

果然就解决了问题;

相关推荐
xixihaha13245 小时前
将Python Web应用部署到服务器(Docker + Nginx)
jvm·数据库·python
xixihaha13245 小时前
Python游戏中的碰撞检测实现
jvm·数据库·python
ID_180079054736 小时前
模拟1688商品详情的Python API实现,返回符合风格的JSON数据
开发语言·python·json
程序员小远6 小时前
软件测试之功能测试详解
自动化测试·软件测试·python·功能测试·测试工具·职场和发展·测试用例
我的xiaodoujiao6 小时前
API接口自动化测试详细图文教程学习系列1--序章
python·学习·pytest
ZhengEnCi6 小时前
P1B-Python环境配置基础完全指南-Windows系统安装与验证
python
m0_716667077 小时前
NumPy入门:高性能科学计算的基础
jvm·数据库·python
带娃的IT创业者7 小时前
Weclaw 请求路由实战:一个 request_id 如何在 800 个并发连接中精准找到目标浏览器?
python·websocket·fastapi·架构设计·实时通信·openclaw·weclaw
2401_844221328 小时前
Python数据库操作:SQLAlchemy ORM指南
jvm·数据库·python
白雨青9 小时前
国信 iQuant 自动国债逆回购实战:Python 自动化闲钱理财
python·量化策略·量化交易·国债逆回购