繁体   English   中英

python 3.11 无法识别 pyttsx3

[英]pyttsx3 not recognized in python 3.11

我正在尝试制作一个 tts 脚本,我已经完成了

pip install pyttsx3

我还安装了以下库:

pywin32
comtypes
pypiwin32

我的 python 版本是 3.11

错误:

Exception has occurred: ModuleNotFoundError
No module named 'pyttsx3'

如果我做```pip show --verbose pyttsx3``我得到:

Name: pyttsx3
Version: 2.90
Summary: Text to Speech (TTS) library for Python 2 and 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.
Home-page: https://github.com/nateshmbhat/pyttsx3
Author: Natesh M Bhat
Author-email: nateshmbhatofficial@gmail.com
License: UNKNOWN
Location: c:\users\codi-\anaconda3\lib\site-packages
Requires: comtypes, pypiwin32, pywin32
Required-by:
Metadata-Version: 2.1
Installer: pip
Classifiers:
  Intended Audience :: End Users/Desktop
  Intended Audience :: Developers
  Intended Audience :: Information Technology
  Intended Audience :: System Administrators
  Operating System :: MacOS :: MacOS X
  Operating System :: Microsoft :: Windows
  Operating System :: POSIX
  License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.5
  Programming Language :: Python :: 3.6
  Programming Language :: Python :: 3.7
Entry-points:
Project-URLs:

难道我做错了什么? 无论我遵循多少教程或指南,都没有修复它

有多种问题会导致此类行为。

首先,考虑为您的 Python 项目使用虚拟环境Anaconda
它将为您解决很多基本问题,更多的是,Anaconda 有conda 包存储库
它不仅非常易于使用,而且会为您提供一些 PyPi 上没有的软件包。
例如,conda 将安装使用 MKL 构建的numpy包,其性能比 PyPi 的版本高约 6 倍。

但是如果你想弄清楚为什么你的特定问题会发生,那么我可以想出一堆为什么会发生这种情况的原因。
有时可能是你的 pip 没有将包安装在你的 python 所在的同一位置。
您可以通过运行pip show pyttsx3 (或使用其他包)轻松检查这一点,然后检查Location:
现在,运行python -m pip show pyttsx3并再次检查Location:
如果它们不相等,那么你的pip命令与其他一些 python 目录相关联。

或者,您可以通过 python 命令安装包,例如python -m pip install pyttsx3 ,以确保包将使用当前的 python 可执行文件安装。

此外,有时它与权限有关。
如果您使用的是 Linux 并使用 root 权限安装了该软件包,那么其他用户将无法访问它。
然后你可能想用 root 权限删除它并用你想要的权限安装(即用户权限)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM