背景环境:

python3.7,pycharm2019,win10系统

由于多年以前安装的环境,安装新库时都使用了pycharm的界面安装,最近在使用命令安装时会报

 The 'pip==19.0.3' distribution was not found and is required by the application错误


pip安装报 The

按提示打开pip3-script.py文件,可以看到倚赖写死了19.0.3版本

# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('pip==19.0.3', 'console_scripts', 'pip3')()
    )

查看当前的pip版本

(venv) D:\project\test>python -m pip -V
pip 21.1.3 from D:\project\venv\lib\site-packages\pip (python 3.7)

修改成当前的pip版本



# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3'

__requires__ = 'pip==21.1.3'

import re

import sys

from pkg_resources import load_entry_point


if __name__ == '__main__':

    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])

    sys.exit(

        load_entry_point('pip==21.1.3', 'console_scripts', 'pip3')()

    )

再安装成功

pip安装报 The