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"

果然就解决了问题;

相关推荐
小鸡吃米…34 分钟前
机器学习中的代价函数
人工智能·python·机器学习
Li emily2 小时前
如何通过外汇API平台快速实现实时数据接入?
开发语言·python·api·fastapi·美股
m0_561359672 小时前
掌握Python魔法方法(Magic Methods)
jvm·数据库·python
Ulyanov2 小时前
顶层设计——单脉冲雷达仿真器的灵魂蓝图
python·算法·pyside·仿真系统·单脉冲
2401_838472513 小时前
使用Python进行图像识别:CNN卷积神经网络实战
jvm·数据库·python
CoLiuRs3 小时前
语义搜索系统原理与实现
redis·python·向量·es
zhihuaba3 小时前
使用PyTorch构建你的第一个神经网络
jvm·数据库·python
u0109272713 小时前
Python Web爬虫入门:使用Requests和BeautifulSoup
jvm·数据库·python
Stream_Silver4 小时前
【Agent学习笔记3:使用Python开发简单MCP服务】
笔记·python
穿过锁扣的风4 小时前
零基础入门 Python 爬虫:从基础到实战,爬取虎扑 / 豆瓣 / 图片全掌握
开发语言·爬虫·python