当前位置: 首页 > news >正文

成功解决ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

在win11电脑上运行ultralytics代码时遇到报错:

UserWarning: Failed to initialize NumPy: DLL load failed while importing _multiarray_umath: 找不到指定的模块。 (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\pytorch\torch\csrc\utils\tensor_numpy.cpp:81.)cpu = _conversion_method_template(device=torch.device("cpu"))
ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

应该是conda环境下和pip安装路径的问题,只需要先卸载pip安装的numpy,再使用conda安装一次即可。

pip uninstall numpy
conda install numpy

继续遇到numpy新问题:

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:

这个错误是由于你使用的代码(或依赖的库)中使用了 np.float,而 NumPy 1.20+ 已移除了 np.float 这个 deprecated(弃用)的别名,它原本是 Python 内置 float 的别名。解决方法很简单,核心是将代码中的 np.float 替换为正确的类型。

这个时候就需要你根据代码的实际情况去除np.float中的np了。比如终端报错输出:

    ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float)

需要改为:

   ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=float)
http://www.dtcms.com/a/313389.html

相关文章:

  • 深度学习中的模型知识蒸馏
  • 深度学习中卷积与互相关
  • 记录使用ruoyi-flowable开发部署中出现的问题以及解决方法
  • FastAPI-Vue3-Admin 一款Python 全栈融合的高可用中后台快速开发平台方案
  • golang 函数选项模式
  • 数据结构(概念及链表)
  • 【数据结构】队列的顺序存储与链式存储(C语言版)
  • 基于深度学习的医学图像分析:使用变分自编码器(VAE)实现医学图像生成
  • (FD Conv)Frequency Dynamic Convolution for Dense Image Prediction论文精读(逐段解析)
  • 07.config 命令实现动态修改配置和慢查询
  • [硬件电路-138]:模拟电路 - 什么是正电源?什么是负电源?集成运放为什么有VCC+和VCC-
  • Unix 发展史概览
  • 探索 Zephyr 项目:高效、可扩展的实时操作系统
  • 源代码本地安装funasr
  • C语言数据结构(6)贪吃蛇项目1.贪吃蛇项目介绍
  • 有限元方法中的数值技术:三角矩阵求解
  • Vulnhub Corrosion2靶机复现
  • 机器人抓取流程介绍与实现——机器人抓取系统基础系列(七)
  • 腾讯云CentOS7镜像配置指南
  • Pytorch实现一个简单的贝叶斯卷积神经网络模型
  • Java 中也存在类似的“直接引用”“浅拷贝”和“深拷贝”
  • [创业之路-530]:创业公司五维架构设计:借鉴国家治理智慧,打造敏捷型组织生态
  • mysql8.0集群技术
  • 第13章 文件输入/输出
  • 知识蒸馏 - 基于KL散度的知识蒸馏 HelloWorld 示例 KL散度公式对应
  • 文件拷贝-代码
  • Doris json_contains 查询报错
  • 数据结构总纲以及单向链表详解:
  • 【LeetCode刷题指南】--对称二叉树,另一颗树的子树
  • [创业之路-531]:知识、技能、技术、科学之间的区别以及它们对于职业的选择的指导作用?