OpenAI Whisper Cannot Import Numpy

题意:"OpenAI Whisper 无法导入 Numpy"

问题背景:

I am trying to run the OpenAI Whisper model but running into the following error when trying to run my script:

"我正在尝试运行 OpenAI Whisper 模型,但在运行脚本时遇到了以下错误:"

ValueError: Unable to compare versions for numpy>=1.17: need=1.17 found=None. This is unusual. Consider reinstalling numpy.

I have, as the error suggests, tried reinstalling Numpy but that didn't solve anything. When I run the command 'pip show numpy' I get:

"正如错误提示的那样,我尝试重新安装 Numpy,但这并没有解决问题。当我运行 'pip show numpy' 命令时,我得到以下输出:"

python 复制代码
Name: numpy
Version: 1.23.5
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD
Location: /opt/homebrew/lib/python3.10/site-packages
Requires: 
Required-by: contourpy, matplotlib, pandas, pythran, scipy, transformers, whisper

So not only do I have Numpy version 1.23.5 (>1.17), it also lists whisper as dependent on the package.

"所以,我不仅安装了 Numpy 1.23.5 版本(>1.17),它还显示 Whisper 依赖于该软件包。"

My machine is a Macbook Air M1 running OS Ventura 13.0.1.

"我的机器是一台运行 macOS Ventura 13.0.1 的 MacBook Air M1。"

I have looked through the OpenAI github for similar issues but I can't seem to find anything of the sort. I also tried importing the package manually with this following:

"我查阅了 OpenAI 的 GitHub,寻找类似的问题,但似乎没有找到相关内容。我还尝试使用以下方式手动导入该软件包:"

python 复制代码
import sys
sys.path.append('/opt/homebrew/lib/python3.10/site-packages/numpy')

But this didn't work either. Please let me know if you have any insight as to why this may be happening.

"但这也没有奏效。如果你对这个问题的原因有任何见解,请告诉我。"

问题解决:

I was able to resolve this issue by navigating to the directory printed by 'pip show numpy', which in my case was "/opt/homebrew/lib/python3.10/site-packages"

"我通过导航到 'pip show numpy' 命令输出的目录解决了这个问题,在我的情况下,该目录是 '/opt/homebrew/lib/python3.10/site-packages'。"

From there, there were some loose numpy related folders despite uninstalling numpy. I deleted these folders and reinstalled numpy using

"在那里,尽管我已经卸载了 Numpy,但仍然有一些与 Numpy 相关的零散文件夹。我删除了这些文件夹,并使用以下命令重新安装了 Numpy:"

python 复制代码
python3 -m pip install numpy

After doing this my code worked as expected.

"在完成这些操作后,我的代码按预期运行了。"

相关推荐
vvoennvv33 分钟前
【Python TensorFlow】 TCN-GRU时间序列卷积门控循环神经网络时序预测算法(附代码)
python·rnn·神经网络·机器学习·gru·tensorflow·tcn
自学互联网1 小时前
使用Python构建钢铁行业生产监控系统:从理论到实践
开发语言·python
无心水1 小时前
【Python实战进阶】7、Python条件与循环实战详解:从基础语法到高级技巧
android·java·python·python列表推导式·python条件语句·python循环语句·python实战案例
xwill*1 小时前
RDT-1B: A DIFFUSION FOUNDATION MODEL FOR BIMANUAL MANIPULATION
人工智能·pytorch·python·深度学习
陈奕昆2 小时前
n8n实战营Day2课时2:Loop+Merge节点进阶·Excel批量校验实操
人工智能·python·excel·n8n
程序猿追2 小时前
PyTorch算子模板库技术解读:无缝衔接PyTorch模型与Ascend硬件的桥梁
人工智能·pytorch·python·深度学习·机器学习
秋邱2 小时前
高等教育 AI 智能体的 “导学诊践” 闭环
开发语言·网络·数据库·人工智能·python·docker
组合缺一2 小时前
Solon AI 开发学习6 - chat - 两种 http 流式输入输出
python·学习·http
沐浴露z2 小时前
为什么使用SpringAI时通常用Builder来创建对象?详解 【Builder模式】和【直接 new】的区别
java·python·建造者模式
青瓷程序设计2 小时前
【宠物识别系统】Python+TensorFlow+Vue3+Django+人工智能+深度学习+卷积神经网络算法
人工智能·python·深度学习