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"

果然就解决了问题;

相关推荐
Flying_Fish_roe6 分钟前
Reactive 编程-Vert.x
开发语言·python
四代机您发多少8 分钟前
入门pytorch
人工智能·pytorch·python
Rin__________40 分钟前
Python计算机视觉 第8章-图像内容分类
python·计算机视觉·分类
西猫雷婶44 分钟前
python画图|3D直方图基础教程
开发语言·python
守望↪星空1 小时前
画图方法总结
python
码农超哥同学1 小时前
Python知识点:如何使用Python进行Excel文件操作(OpenPyXL、Pandas)
python·面试·excel·pandas·编程
一只会敲代码的小灰灰1 小时前
python学习第九节:爬虫实战-抓取地址库
爬虫·python·学习
AI原吾2 小时前
探索自动化的魔法:Python中的pyautogui库
运维·python·自动化
长风清留扬2 小时前
Python “集合” 100道实战题目练习,巩固知识、检查技术
数据结构·python·面试·跳槽·学习方法·集合·改行学it
鸽芷咕2 小时前
【BUG报错已解决】`ERROR: Failed building wheel for jupyter-nbextensions-configurator`
ide·python·jupyter