当前位置:网站首页>【DEBUG】ImportError: Unable to import required dependencies: numpy: DLL load failed: 找不到指定的模块。
【DEBUG】ImportError: Unable to import required dependencies: numpy: DLL load failed: 找不到指定的模块。
2022-08-02 21:10:00 【IT里的交易员】
解决pandas与numpy版本不协调导致的“找不到指定的模块”的问题
一、问题表现
Traceback (most recent call last):
File “D:\hq_test.py”, line 74, in
from pytdx.hq import TdxHq_API
File “D:\Program\Anaconda3\lib\site-packages\pytdx\hq.py”, line 15, in
import pandas as pd
File “D:\Program\Anaconda3\lib\site-packages\pandas_init_.py”, line 17, in
“Unable to import required dependencies:\n” + “\n”.join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: DLL load failed: 找不到指定的模块。
二、问题分析
安装和升级第三方库,有些第三方库依赖pandas及numpy,但其在安装升级过程中,可能导致pandas与numpy库版本不协调,从而导致pandas调用numpy时出现找不到numpy库模块的现象。
三、解决问题
1.参考解决方案
先查看当前安装的版本,然后卸载,再重新安装指定版本。通过这种适当降低pandas的版本号来解决兼容问题。有时候迫不得已,这种方法是可以临时解决问题的。
查看pandas可安装的所有版本号
随便传一个超大的版本号,即可获取所有可用版本号,如下:
pip install pandas==10000
cmd命令窗口反馈如下:
ERROR: Ignored the following versions that require a different python version: 1.4.0 Requires-Python >=3.8; 1.4.0rc0 Requires-Python >=3.8; 1.4.1 Requires-Python >=3.8; 1.4.2 Requires-Python >=3.8; 1.4.3 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement pandas10000(from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5)
ERROR: No matching distribution found for pandas10000
卸载后安装指定版本pandas库
pip uninstall pandas
pip install pandas==1.3.1
这个办法有时候还是不能解决问题。于是又进行了各种百度。最后通过如下办法解决。真是踏破铁鞋无觅处,得来全不费工夫。
2.推荐解决方案
今天来个终极解决办法,直接更新到最新版本。这个方法简单,高效,可以解决大部分问题。但有些软件因为不能使用高版本库,所以第一个方法还是有用的。
pip install --upgrade pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --upgrade numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
升级后成功安装以下版本:
Successfully installed pandas-1.3.5
Successfully installed numpy-1.21.6
我的环境通过以下语句,执行完毕后,运行python代码正常了。
四、总结
以上两种办法,适用于各种库版本的问题。解决方法看似简单,可也是走过很多弯路才搞定的。在此,对消耗的脑细胞说声对不起啦!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
边栏推荐
- JumpServer open source bastion machine completes Loongson architecture compatibility certification
- UDP (User Datagram Protocol)
- Flink优化的方方面面
- 最近火爆朋友圈的“广告电商”,核心商业模式是什么,广告收入真实靠谱吗?
- WPF development through practical 】 【 automatic production management platform
- 源码构建LAMP环境-3
- 【c】操作符详解(一)
- 微软SQL服务器被黑客入侵以窃取代理服务的带宽
- win10安全中心设置不扫描某个文件夹的方法
- 汇编语言中b和bl关键字的区别
猜你喜欢
随机推荐
LeetCode 2360. 图中的最长环 基环树找环+时间戳
C# Monitor class
STP生成树协议
Flink Yarn Per Job - 创建启动Dispatcher RM JobManager
矩阵白化原理及推导
C primer plus学习笔记 —— 9、联合&枚举&typdef
The software testing process specification is what?Specific what to do?
抽象工厂模式
用户之声 | 大学生的“课外学堂”
Mysql用户管理
JumpServer open source bastion machine completes Loongson architecture compatibility certification
Adobe官方清理工具Adobe Creative Cloud Cleaner Tool使用教程
A brief discussion on the transformation of .NET legacy applications
14、学习MySQL 连接的使用
典型相关分析CCA计算过程
什么是幂等
【干货】分库分表最佳实践
Flink优化及相关
Li Mu hands-on deep learning V2-BERT pre-training and code implementation
并发与并行









