Python 无法导入 Whisper - ctypes.util.find_library('c') 返回 None

问题描述 投票:0回答:1

我在 Windows 10 上使用 PyCharm 并运行“Python 3.9.9”。这是我的代码。我想导入 whisper 但在 whisper.py 第 70 行出现错误。我检查了那一行:

libc_name = ctypes.util.find_library('c')
find_library
函数找不到
'c'
库并返回
None
。如何找到 libc 并为
find_library
函数提供绝对路径或目录?

main.py

import whisper

if __name__ == '__main__':
    model = whisper.load_model("base")
    result = model.transcribe("turkce.mp3")
    print(result["text"])

错误:

C:\Users\root\AppData\Local\Microsoft\WindowsApps\python3.9.exe D:\PycharmProjects\SpeechToText\main.py 
None
Traceback (most recent call last):
  File "D:\PycharmProjects\SpeechToText\main.py", line 1, in <module>
    import whisper as wp
  File "C:\Users\root\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\whisper.py", line 70, in <module>
    libc = ctypes.CDLL(libc_name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 364, in __init__
    if '/' in name or '\\' in name:
TypeError: argument of type 'NoneType' is not iterable

Process finished with exit code 1

我已经尝试卸载 whisper 并从 github 重新安装;

pip uninstall whisper
pip install git+https://github.com/openai/whisper.git

https://github.com/openai/whisper/discussions/120

python ctypes whisper openai-whisper
1个回答
0
投票

我通过在 anaconda 中运行一个新环境并重新安装模块解决了这个确切的问题,因为原始环境不接受这些模块。由于这只是我编码的第二天,我不确定真正有帮助的是什么,但原始环境仍然无法正常工作。我希望它有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.