当前位置:网站首页>【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代码正常了。
四、总结
以上两种办法,适用于各种库版本的问题。解决方法看似简单,可也是走过很多弯路才搞定的。在此,对消耗的脑细胞说声对不起啦!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
以后发现库版本不兼容,找不到模块的问题,都先给升级到最新版本!
边栏推荐
- Intensive reading of the Swin Transformer paper and analysis of its model structure
- 增删改查这么多年,最后栽在MySQL的架构设计上!
- Informatics Olympiad All-in-One (1257: Knight Moves)
- Packages and packages, access modifiers
- C# Monitor class
- The Orsay in Informatics (1256: Bouquet for Algernon)
- C语言中变量在内存中的保存与访问
- 人尽皆知的云原生,到底是大势所趋还是过度炒作?
- 拥抱Cmake小朋友 简单又实用,但是不灵活
- golang刷leetcode:巫师的总力量和
猜你喜欢

Informatics orsay a tong (1258: 【 9.2 】 digital pyramid)

【STM32学习3】DMA基础操作

Use the TCP protocol, we won't lost package?

矩阵白化原理及推导

Wiring diagrams of switches, motors, circuit breakers, thermocouples, and meters

Electrical diagram of power supply system

Vscode快速入门、 插件安装、插件位置、修改vscode默认引用插件的路径、在命令行总配置code、快捷键

How to quickly compare two byte arrays for equality in .NET

终于明白:有了线程,为什么还要有协程?

面试官居然问我:删库后,除了跑路还能干什么?
随机推荐
golang 刷leetcode:祖玛游戏
Day12 接口和协议
The software testing process specification is what?Specific what to do?
主成分分析(PCA)
【3D视觉】深度摄像头与3D重建
Win10怎么开启自带的游戏录屏功能?
golang刷leetcode:统计区间中的整数数目
sre成长之路
2018HBCPC个人题解
@Transactional 事务调用与生效场景总结
面试了个985毕业的,回答“性能调优”题时表情令我毕生难忘
Li Mu hands-on deep learning V2-BERT pre-training and code implementation
C语言中变量在内存中的保存与访问
回文自动机+CodeTON Round 2 C,D
【流媒体】推流与拉流简介
UDP (User Datagram Protocol)
[C题目]力扣141. 环形链表
golang刷leetcode:拼接数组的最大分数
js: 实现一个cached缓存函数计算结果
golang刷leetcode:我能赢吗