简单导入会引发错误;关于为什么无法使用Python导入whisper,有什么想法吗?

huangapple go评论64阅读模式
英文:

Simple import is throwing an error; any ideas on why I'm not able to import whisper using python?

问题

我能够在今天早些时候成功运行我的代码,但是从今天晚上开始,当尝试导入Whisper时,我遇到了语法错误。有什么想法?

line 9, in <module>
    import whisper
  File "/miniconda/lib/python3.7/site-packages/whisper/__init__.py", line 11, in <module>
    from .audio import load_audio, log_mel_spectrogram, pad_or_trim
  File "/miniconda/lib/python3.7/site-packages/whisper/audio.py", line 10, in <module>
    from .utils import exact_div
  File "/miniconda/lib/python3.7/site-packages/whisper/utils.py", line 108
    if word_timings := segment.get("words", None):
                     ^
SyntaxError: invalid syntax
英文:

I was able to successfully run my code earlier today, but as of this evening I am getting a syntax error when trying to import Whisper. Any ideas?

line 9, in <module>
    import whisper
  File "/miniconda/lib/python3.7/site-packages/whisper/__init__.py", line 11, in <module>
    from .audio import load_audio, log_mel_spectrogram, pad_or_trim
  File "/miniconda/lib/python3.7/site-packages/whisper/audio.py", line 10, in <module>
    from .utils import exact_div
  File "/miniconda/lib/python3.7/site-packages/whisper/utils.py", line 108
    if word_timings := segment.get("words", None):
                     ^
SyntaxError: invalid syntax

答案1

得分: 0

抛出错误的海象运算符仅自Python 3.8起可用。看起来您正在使用Python 3.7。

英文:

The walrus operator raising the error is only available since Python 3.8. It seems you are working with Python 3.7.

huangapple
  • 本文由 发表于 2023年3月7日 13:35:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75658370.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定