【Python issue】ModuleNotFoundError: No module named 'pip._internal.utils'
一、场景
使用VSCode编写Python代码。
之前已经激活虚拟环境,并可以在虚拟环境下使用pip正常安装。
但第二天在激活虚拟环境后,使用pip安装包,报错:ModuleNotFoundError: No module named 'pip._internal.utils'
二、报错原因
这篇博客讲的很清楚:
https://www.pythonclear.com/errors/modulenotfounderror-no-module-named-pip-_internal/
报错的原因是:
The “modulenotfounderror: no module named ‘pip._internal'” error arises when the pip package installation is incorrect, has been tampered with, or you have upgraded pip and the new structure of pip is different from the old structure.
当pip包安装不正确、已被篡改,或者您已升级pip并且pip的新结构与旧结构不同时,会出现“modulenotfounderror:没有名为'pip._internal'的模块”错误。
三、解决方法
试了很多方法都不行,直接重装Python,并删除了多余的版本。
成功解决。
浙公网安备 33010602011771号