小编use*_*007的帖子

使用pyttsx的python文本到语音

我想用我的覆盆子pi宣布一些文字.我已经安装了pyttsx但是无法使用它.我正在使用python2.7

我的节目:

import pyttsx
engine= pyttsx.init()
engine.setProperty('rate',70)
voices=engine.getProperty('voices')
for voice in voices:
    print "Using voice:", repr(voice)
    engine.setProperty('voice',voice.id)
    engine.say("Hello Hello Hello")
engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

Traceback (most recent call last):
File "/home/pi/announce.py", line 2, in <module>
engine= pyttsx.init()
File "/usr/local/lib/python2.7/dist-packages/pyttsx-1.1-     py2.7.egg/pyttsx/__init__.py", line 39, in init
eng = Engine(driverName, debug)
File "/usr/local/lib/python2.7/dist-packages/pyttsx-1.1- py2.7.egg/pyttsx/engine.py", line 45, in __init__
 self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
 File "/usr/local/lib/python2.7/dist-packages/pyttsx-1.1-p   y2.7.egg/pyttsx/driver.py", line 64, in __init__
  self._module = __import__(name, globals(), locals(), [driverName])
  File "/usr/local/lib/python2.7/dist-packages/pyttsx-1.1-py2.7.egg/pyttsx/drivers/espeak.py", line 19, in <module>
   import _espeak
   File …
Run Code Online (Sandbox Code Playgroud)

python raspberry-pi pyttsx

11
推荐指数
2
解决办法
9926
查看次数

pyinstaller 没有用于树莓派的预定义编译器

我想将 myscript.py 转换为可执行文件。我正在使用树莓派(raspbian)和 python 2.7。

我发出以下命令

sudo pip install PyInstaller
sudo pyinstaller myscript.py
Run Code Online (Sandbox Code Playgroud)

经过一些处理后,它提供了一个错误

Fatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. See <http://pythonhosted.org/PyInstaller/#building-the-bootloader>
for more details and instructions how to build the bootloader.
Run Code Online (Sandbox Code Playgroud)

我去网上构建编译器,但无法理解这个过程。我怎么能解决这个问题?

python pyinstaller raspberry-pi raspbian

6
推荐指数
2
解决办法
8191
查看次数

标签 统计

python ×2

raspberry-pi ×2

pyinstaller ×1

pyttsx ×1

raspbian ×1