我成功安装了 pyttsx3pip install pyttsx3并编写了以下代码:
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
text = 'hello'
speak(text)
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,出现以下错误:
Traceback (most recent call last):
File "/home/walter197/.local/lib/python3.6/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/usr/lib/python3.6/weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "scrap.py", line 104, in <module>
speak(text)
File "scrap.py", line 100, in speak
engine = pyttsx3.init()
File "/home/walter197/.local/lib/python3.6/site-packages/pyttsx3/__init__.py", line 22, in …Run Code Online (Sandbox Code Playgroud) 我有以下结构:
typedef struct Position Position;
struct Position
{
int x;
int y;
};
Run Code Online (Sandbox Code Playgroud)
我想定义一个新类型,它是 Position struct 的二维数组。我怎样才能做到这一点?返回此类数组的函数的类型是什么?