- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
Python 中是否有任何库可以或允许使用 Mac Lion 的内置文本到语音引擎进行文本到语音转换?我没有谷歌,但大多数是基于 Windows 的。我试过pyttx。我试着跑了
import pyttsx
engine = pyttsx.init()
engine.say('Sally sells seashells by the seashore.')
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
但是我得到了这些错误
File "/Users/manabchetia/Documents/Codes/Speech.py", line 2, in <module>
engine = pyttsx.init()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/__init__.py", line 39, in init
eng = Engine(driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/engine.py", line 45, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/driver.py", line 64, in __init__
self._module = __import__(name, globals(), locals(), [driverName])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyttsx-1.0.egg/pyttsx/drivers/nsss.py", line 18, in <module>
ImportError: No module named Foundation
如何解决这些错误?
最佳答案
这样做不是更简单吗?
from os import system
system('say Hello world!')
您可以输入 man say
以查看可以使用 say
命令执行的其他操作。
但是,如果您想要一些更高级的功能,也可以导入 AppKit
,尽管需要一些 Cocoa/Objective C 知识。
from AppKit import NSSpeechSynthesizer
speechSynthesizer = NSSpeechSynthesizer.alloc().initWithVoice_("com.apple.speech.synthesis.voice.Bruce")
speechSynthesizer.startSpeakingString_('Hi! Nice to meet you!')
如果您想了解使用 NSSpeechSynthesizer 可以做的更多事情,请查看 Apple 的文档:https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSSpeechSynthesizer_Class/Reference/Reference.html
关于Macintosh 中的 Python 文本转语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12758591/
我怎样才能只创建模拟器...可能吗?我知道,设备需要分发证书。 最佳答案 您只需将应用程序目录从 iPhone 模拟器复制到另一个实例/操作系统版本,它就应该可以工作。 因此,如果您想分发 3.1.3
是否有一种经过认可的、未弃用的方法来检测 OS X 文件是否是文具本? 据我所知,NSFileManager 方法都没有提供 isStationery 键,并且旧的 FSpGetFInfo() 方法当
正如我在较早的问题中所说,我们(我和我的 friend )正在尝试在 Macintosh IIci(系统 7.5.5 68k 处理器)中进行开发,但我们不知道从哪里开始,所以我在这里问用于开发一些资源
您会推荐什么适用于 macintosh 的安装程序软件?它必须支持豹和雪豹。易于编写脚本且成本不高。 谢谢, 纳瓦 最佳答案 最佳答案是:不要。 “Mac 方式”仅提供一个 .app,用户可以将其拖入
为什么有些 Mac 应用程序非常乐意简单地复制到/Applications 文件夹中,而其他应用程序则需要安装向导软件?巫师有什么优势吗? 最佳答案 您可能对苹果公司在这个问题上的说法感兴趣。这是在
我有一个整数,表示自凌晨 12:00 以来经过的毫秒数。 1904 年 1 月 1 日。我相信这也称为麦金塔时间。这是原始 Mac 操作系统使用的基准时间。 通常我会这样做: int millis =
Python 中是否有任何库可以或允许使用 Mac Lion 的内置文本到语音引擎进行文本到语音转换?我没有谷歌,但大多数是基于 Windows 的。我试过pyttx。我试着跑了 import pyt
无法在“Macintosh HD”上安装 Xcode,因为需要 macOS 10.12.6 或更高版本。我的 macitosh 版本是 10.12,但是当我搜索更新时它询问没有可用的更新 最佳答案 需
我在 Macintosh 上,我的 shell 使用“终端”。当我从任何窗口复制文本(通过鼠标拖动然后鼠标右键菜单 -> 复制),然后将文本(鼠标右键 -> 粘贴)粘贴到运行 emacs 的终端时,它
我正在尝试从命令行或 Python 程序创建 Finder 别名。我搜索了网络[1][2][3]并找到了这段applescript: $ osascript -e 'tell application
我正在尝试使用 Netbeans 6.7(在 Mac 上)创建 C++ 应用程序。我从标准的“Hello World”开始,只是为了测试一切是否正常工作。首先尝试 std 并找不到。所以我尝试在我的
我将说明我的问题的用例。 我这里有两个文件,它们恰好是来自旧版 Mac OS 的 Finder 7.5.5 和 Finder 8.1。 如果我使用 Cmd + I 我会得到以下信息: Version:
我无法访问 Macintosh 来测试它(即,我无法加载 Xamarin Mac 组件)所以我没有办法测试它。但是...下面是 WPF 应用程序的 XAML。应用程序中的大多数内容似乎都符合 Xama
我一直在按照本教程 (http://blogs.wcode.org/2014/10/howto-install-build-and-use-opencv-macosx-10-10/) 在我的 Macb
我正在尝试创建一个驻留在通知区域或任务栏/系统托盘区域中的简单应用程序。我希望它是跨平台的,所以这就是我使用 wxPython 的原因。 该应用程序在 Windows 和 Linux 下运行良好,但在
我有一个非常奇怪的方法,用于隐藏 JInternalFrame 的标题栏。现在的困境是下面的方法适用于 windows 平台, ((javax.swing.plaf.basic.BasicIntern
我有以下 http://jsbin.com/ojeja4/2/edit 按钮和到期日期在 Windows 中、所有浏览器中都正常工作,但在 OS X 中的 safari 和 firefox(可能还有其
我是系统编程的新手,我想您或许可以提供帮助。 我正在学习 Windows 上基于消息的编程(如 getmessage()),我的许多消息来源都将其称为典型的 Windows 事物。 这是 Mac 上的
对于用户输入,我这样做:$var=str_replace(array('\r','\n'),'',$var); 在 Windows 上运行良好,删除任何新行。但是,在 Mac (+Firefox) 上
我有一个使用 VS2008/.NET 3.5 开发的 Word 2007 加载项。 我需要做什么才能让 Mac 用户在 Word 2008 中使用此加载项? (或者 MS 是否确保不可能做到.....
我是一名优秀的程序员,十分优秀!