简体   繁体   English

python 3.11 无法识别 pyttsx3

[英]pyttsx3 not recognized in python 3.11

i am trying to make a tts script and i have done我正在尝试制作一个 tts 脚本,我已经完成了

pip install pyttsx3

i have also installed the following librarys:我还安装了以下库:

pywin32
comtypes
pypiwin32

my python version is 3.11我的 python 版本是 3.11

error:错误:

Exception has occurred: ModuleNotFoundError
No module named 'pyttsx3'

if i do ```pip show --verbose pyttsx3`` i get:如果我做```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:

am i doing something wrong?难道我做错了什么? no matter how many tutorials or guides i follow none have fixed it无论我遵循多少教程或指南,都没有修复它

There are multiple issues that can cause such behaviour.有多种问题会导致此类行为。

First of all , consider using virtual environments or Anaconda for your Python projects.首先,考虑为您的 Python 项目使用虚拟环境Anaconda
It will solve lots of basic issues for you, and more of that, Anaconda have conda packages repository .它将为您解决很多基本问题,更多的是,Anaconda 有conda 包存储库
Not only it is very easy to use, but it will provide you with some packages that are not available at PyPi.它不仅非常易于使用,而且会为您提供一些 PyPi 上没有的软件包。
For example, conda will install numpy package built with MKL, that is ~6x more performant, than the version from PyPi.例如,conda 将安装使用 MKL 构建的numpy包,其性能比 PyPi 的版本高约 6 倍。

But if you want to figure out why your specific issue is happening, then I can come up with a bunch of reasons why this can happen.但是如果你想弄清楚为什么你的特定问题会发生,那么我可以想出一堆为什么会发生这种情况的原因。
Sometimes it can be that your pip does not installed the package at the same location where your python is located.有时可能是你的 pip 没有将包安装在你的 python 所在的同一位置。
You can easily check this by running pip show pyttsx3 (or with another package) , then check the Location: .您可以通过运行pip show pyttsx3 (或使用其他包)轻松检查这一点,然后检查Location:
Now, run python -m pip show pyttsx3 and check the Location: again.现在,运行python -m pip show pyttsx3并再次检查Location:
If they are not equal, then your pip command is associated with some other python directory.如果它们不相等,那么你的pip命令与其他一些 python 目录相关联。

Alternatively you can just install the package through python command like this python -m pip install pyttsx3 in order to make sure, that the package will be installed using current python executable.或者,您可以通过 python 命令安装包,例如python -m pip install pyttsx3 ,以确保包将使用当前的 python 可执行文件安装。

Also, sometimes it's about permissions.此外,有时它与权限有关。
If you are using Linux and installed the package with root permissions, then other users will not be able to access it.如果您使用的是 Linux 并使用 root 权限安装了该软件包,那么其他用户将无法访问它。
Then you may want to remove it with root permissions and install with the permissions you want (ie user perms) .然后你可能想用 root 权限删除它并用你想要的权限安装(即用户权限)

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

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