python - 类型错误模块对象不可调用python gtts
问题描述
我正在使用 gtts 但是当我运行它时它说:
TypeError 'module' object is not callable
有谁知道我应该怎么做?如果它有帮助我在 Windows 上使用 python 3.8.6 非常感谢这里是代码:
import os
from gtts import gTTS
text_to_read = "Hello my name is Alex. What's your name? "
language = 'en'
slow_audio_speed = False
filename = '1.mp3'
def reading_from_string():
audio_created = gTTS(text=text_to_read, lang=language,
slow=slow_audio_speed)
audio_created.save(filename)
if platform == "linux":
os.system(f'omxplayer --no-keys {filename}')
elif platform == 'win32':
os.system(f'start {filename}')
else:
print("I am not compatible with your device")
exit()
reading_from_string()
解决方案
推荐阅读
- react-native - instagram 故事进度条有库吗?
- html - 为什么apache2没有显示我的css文件,但是当我打开本地文件时它可以工作?
- android - Flutter、firebase_admob 原生 admob 广告颜色
- android - Metasploit 打开 Meterpreter,但 shell 无响应
- flask - 还有另一种使用 Jinja2 语法打印内容的方法吗?
- javascript - (Vue 2)无法在插件中全局注册异步组件以在主项目中使用
- python - 如何使用在归一化输入上训练的模型对看不见的输入进行归一化以进行预测?
- r - 为随机森林树训练数据时出错 - 我该如何解决?
- crash - VM 在通过 VPN 进行 rsync 和 scp 传输期间间歇性崩溃
- node.js - 在函数中执行 Node.JS 终端命令