ModuleNotFoundError: No module named ‘pip‘

使用pip 安装包 遇到这个问题,简单记录下如何解决。

问题:

ModuleNotFoundError: No module named ‘pip‘_第1张图片

解决: 命令行输入如下命令

python -m ensurepip
python -m pip install --upgrade pip

解释:

官网解释:

ensurepip — Bootstrapping the pip installer

New in version 3.4.

The ensurepip package provides support for bootstrapping the pip installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that pip is an independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.

In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip.

Note

This module does not access the internet. All of the components needed to bootstrap pip are included as internal parts of the package.

这个 ensurepip包提供对引导pip安装到现有的python安装或虚拟环境中。这种自举方法反映了这样一个事实:pip` 是一个独立的项目,有自己的发布周期,最新的稳定版本与cpython参考解释器的维护和特性发布捆绑在一起。

upgrade pip 更新pip模块

参考 :

https://www.w3cschool.cn/doc_python_3_6/python_3_6-library-ensurepip.html

https://blog.csdn.net/haihonga/article/details/100168691

你可能感兴趣的:(Python,python,pip)