关于Python中install edge_tts记录

如下代码:

python 复制代码
#!/usr/bin/env python3

"""
Basic audio streaming example.

This example shows how to stream the audio data from the TTS engine,
and how to get the WordBoundary events from the engine (which could
be ignored if not needed).

The example streaming_with_subtitles.py shows how to use the
WordBoundary events to create subtitles using SubMaker.
"""

import asyncio
import edge_tts

TEXT = "Hello World!"
VOICE = "en-GB-SoniaNeural"
OUTPUT_FILE = "test.mp3"


async def amain() -> None:
    """Main function"""
    communicate = edge_tts.Communicate(TEXT, VOICE)
    with open(OUTPUT_FILE, "wb") as file:
        async for chunk in communicate.stream():
            if chunk["type"] == "audio":
                file.write(chunk["data"])
            elif chunk["type"] == "WordBoundary":
                print(f"WordBoundary: {chunk}")


if __name__ == "__main__":
    asyncio.run(amain())

要求 impoty edge_tts

通过命令行pip3 install edge_tts虽然提示导入成功,但是引用时发现提示不能使用。

经过无数次的install 和 uninstall 均不成功

最后通过也面操作成功,记录如下:

1、首先发现使用pip3 install 安装提示成功后

这个地方没有edge_tts Lib,(上图是最后安装成功的图版)

2、通过功能进行安装(最后成功)

这样安装后,在代码中才可以使用。不知道为什么会这样????

相关推荐
找不到、了36 分钟前
MySQL 索引下推(ICP)的实战,彻底提升查询性能
数据库·mysql
b***676438 分钟前
Springboot3 Mybatis-plus 3.5.9
数据库·oracle·mybatis
kitty_hi39 分钟前
mysql主从配置升级,从mysql5.7升级到mysql8.4
linux·数据库·mysql·adb
顾安r1 小时前
11.20 开源APP
服务器·前端·javascript·python·css3
萧鼎1 小时前
Python PyTesseract OCR :从基础到项目实战
开发语言·python·ocr
没有bug.的程序员3 小时前
Java 字节码:看懂 JVM 的“机器语言“
java·jvm·python·spring·微服务
王宪笙3 小时前
Qt之数据库使用示例
数据库·qt
q***42823 小时前
Redis 设置密码(配置文件、docker容器、命令行3种场景)
数据库·redis·docker
运维行者_4 小时前
网站出现 525 错误(SSL 握手失败)修复指南
服务器·网络·数据库·redis·网络协议·bootstrap·ssl
fruge4 小时前
openGauss数据库实操过程:从环境搭建到连接配置,第三方软件进行数据库管理
数据库·oracle