未找到模块 pip
Posted
技术标签:
【中文标题】未找到模块 pip【英文标题】:Module not found pip 【发布时间】:2022-01-05 23:30:30 【问题描述】:由于某种原因,找不到我的 pttsx3 模块,我在有和没有虚拟环境的情况下都安装了它,它甚至显示我通过 pip 列表在 pip 安装中拥有它
(env) PS E:\Programs I wrote heh\My Ai\bin> e:; cd 'e:\Programs I wrote heh\My Ai\bin'; & 'C:\Users\mmmke\AppData\Local\Programs\Python\Python39\python.exe' 'c:\Users\mmmke\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy\launcher' '63935' '--' 'e:\Programs I wrote heh\My Ai\bin\Text to speach.py'
Traceback (most recent call last):
File "C:\Users\mmmke\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
exec(code, run_globals)
File "c:\Users\mmmke\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\mmmke\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\mmmke\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Users\mmmke\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 268, in run_path
File "C:\Users\mmmke\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\mmmke\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "e:\Programs I wrote heh\My Ai\bin\Text to speach.py", line 1, in <module>
import pyttsx3 #pip install pyttsx3
ModuleNotFoundError: No module named 'pyttsx3'
(env) PS E:\Programs I wrote heh\My Ai\bin> which python
which : The term 'which' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ which python
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (which:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
(env) PS E:\Programs I wrote heh\My Ai\bin> pip list
Package Version
---------- -------
comtypes 1.1.10
pip 20.2.3
pypiwin32 223
pyttsx3 2.90
pywin32 302
setuptools 49.2.1
wheel 0.37.0
WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'e:\programs i wrote heh\my ai\bin\env\scripts\python.exe -m pip install --upgrade pip' command.
(env) PS E:\Programs I wrote heh\My Ai\bin>
【问题讨论】:
请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。 【参考方案1】:你说你没有使用虚拟环境,但是你的pip似乎属于python at
e:\programs i wrote heh\my ai\bin\env\scripts\python.exe
而您用来运行脚本(具有导入行)的 python 是
C:\Users\mmmke\AppData\Local\Programs\Python\Python39\python.exe
所以要么使用e:\programs i wrote heh\my ai\bin\env\scripts\python.exe
运行你的脚本,要么安装正确的python:
C:\Users\mmmke\AppData\Local\Programs\Python\Python39\python.exe -m pip install ...
【讨论】:
以上是关于未找到模块 pip的主要内容,如果未能解决你的问题,请参考以下文章
未找到 windows 10 python 串行模块,但 pip install pyserial 已通过
pip install: 无法打开文件 pip,或父模块''未加载