【BUG】ImportError: Unable to import required dependencies:numpy: IMPORTANT: PLEASE READ THIS FOR ADVI

ImportError: Unable to import required dependencies:numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following: * The Python version is: Python3.9 from “C:\Users\xxxx.conda\envs\xgb\python.exe”

  • The NumPy version is: “1.22.3”
    and make sure that they are the versions you expect.
    Please carefully study the documentation linked above for further help.
    Original error was: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

问题原因:numpy安装重复
处理流程:

1. 用 pip uninstall numpy 卸载numpy
2. 再用conda list 查看还有还有一个numpy
3. 此时在相应环境命令行输入python直接进入python编译环境,import numpy会发现找不到numpy
4. 此时如果用conda uninstall numpy 会连带卸载需要依赖numpy的包如pandas等
5. 此时如果用conda instll numpy 会提示你更新numpy和安装numpy-base
6. 完成第五步后又回到了第一步,此时环境中又存在了两个同样版本的numpy,此时操作第三步会发现可以正常导入numpy,在terminal中也可以正常运行代码,但是使用pycharm的run和debug均会导致最开始同样的问题
7. 此时选择第一步和第四步即卸载完所有的numpy版本和关联的包
8. 此时如果用conda 重新安装被卸载的包会发现又回到了问题的开始,貌似conda会缓存安装过的包保存在临时文件中,安装时优先安装缓存文件
9. 最后采用pip 重新安装被卸载的包和numpy成功解决问题

总结:

1. 用conda和pip各卸载一遍numpy
2. 用pip把被卸载的关联包下载回来
pip uninstall numpy 
conda uninstall numpy #conda会提醒你相关的包也将被删除,选择yes 
pip install xxx # 用pip把相应的包下回来
  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值