简体   繁体   English

Python 没有名为 pip 的模块

[英]Python no module named pip

I use windows 7 32 bit and python 3.7.我使用 windows 7 32 位和 python 3.7。 I was trying to install a module with pip and this error came up:我试图用 pip 安装一个模块,但出现了这个错误:

C:\Windows\System32>pip install pyttsx3
Traceback (most recent call last):
  File "d:\python\python 3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\python\python 3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Python\Python 3.7\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

Does anybody know how to fix this?有人知道如何解决这个问题吗?

Make sure you have python path added to the PATH variable.确保您已将 python 路径添加到PATH变量中。 Then run然后运行

python -m ensurepip

Start Python Setup again ( Download from here ) and be sure to tick that Add python to PATH at the bottom of installation.再次启动 Python 安装程序(从此处下载)并确保在安装底部勾选Add python to PATH

Could you try?你能试试吗?

pip3 install pyttsx3

To me for Ubuntu 20.04 helped the following:对我来说Ubuntu 20.04有以下帮助:

ls -al /usr/bin/python # check before removal that 'python' is link
sudo rm /usr/bin/python # remove link to old version of python
sudo ln -s /usr/bin/python3.8 /usr/bin/python # create new link to actual python version
sudo apt install python3-pip # install missing pip

"Python: No module named pip" was because of missing python3-pip . “Python:没有名为 pip 的模块”是因为缺少python3-pip

  1. Download get-pip.py to a folder on your computer.将 get-pip.py下载到您计算机上的文件夹中。

  2. Open a command prompt and navigate to the folder containing the get-pip.py installer.打开命令提示符并导航到包含 get-pip.py 安装程序的文件夹。

  3. Run the following command:运行以下命令:

    python get-pip.py python get-pip.py

  4. 4-) Verify Installation and Check the Pip Version: 4-) 验证安装并检查 Pip 版本:

    pip -V pip -V

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

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