在安装matplotlib的过程中,不小心损坏了pip文件,本来想用easy_install pip命令进行重装,可是却显示了
Searching for pip
Reading https://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or working download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
失败了,于是换用
pip install -U pip
pip install --upgrade pip
等都没有成功,显示
Cannot open D:\python\Anaconda\envs\tensorflow\Scripts\pip-script.py
查阅资料后尝试了输入
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
显示
(tensorflow) C:\WINDOWS\system32>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1892k 100 1892k 0 0 35233 0 0:00:55 0:00:55 --:--:-- 88633
证明下载成功
输入
python get-pip.py
把下载下来的get-pip.py程序进行编译
(tensorflow) C:\WINDOWS\system32>python get-pip.py
Collecting pip
Using cached pip-21.2.1-py3-none-any.whl (1.6 MB)
Installing collected packages: pip
Successfully installed pip-21.2.1
成功重装pip
(为避免不必要的问题,需要使用管理员运行)