【发布时间】:2016-05-10 03:57:18
【问题描述】:
我正在尝试在 python 3.4 中运行此代码:
from pygsr import Pygsr
speech = Pygsr()
# duration in seconds
speech.record(3)
# select the language
phrase, complete_response = speech.speech_to_text('en_UK')
print(phrase)`
但我得到了错误
File "/usr/local/lib/python3.4/dist-packages/pygsr/__init__.py", line 33, in record
for i in range(0, self.rate / self.chunk * time):
TypeError: 'float' object cannot be interpreted as an integer
关于为什么的任何想法?除了从 pygsr PyPi 站点将 'es_ES' 更改为 'en_UK' 之外,我没有修改代码。
【问题讨论】:
-
人们可能会投票反对我,但我的建议是使用 numpy.arange,而不是 docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html
标签: python python-3.x