英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论