在 Python 中用给定的语言说单词
Saying words in a given language in Python
Python 如何用给定的语言说单词?
当我尝试这个时:
import os
os.system("say 'hi'")
Python显示:
sh: 1: say: not found
当我尝试这个时:
import pyttsx3;
engine = pyttsx3.init();
engine.say("I will speak this text");
engine.runAndWait();
Python表示没有libespeak.so.1
这样的file/directory,而运行表示__init__()
。
最后,我尝试了:
import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak("This is the pc voice speaking")
Python告诉我没有win32com
.
尝试安装pypiwin32
pip install pypiwin32
这是为了
import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak("This is the pc voice speaking")
Python 如何用给定的语言说单词?
当我尝试这个时:
import os
os.system("say 'hi'")
Python显示:
sh: 1: say: not found
当我尝试这个时:
import pyttsx3;
engine = pyttsx3.init();
engine.say("I will speak this text");
engine.runAndWait();
Python表示没有libespeak.so.1
这样的file/directory,而运行表示__init__()
。
最后,我尝试了:
import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak("This is the pc voice speaking")
Python告诉我没有win32com
.
尝试安装pypiwin32
pip install pypiwin32
这是为了
import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak("This is the pc voice speaking")