今天在安装对pip的版本进行升级时报错,结果出现下述所示的错误信息:
(base) C:\Users\test>pip install --upgrade pip Script file 'D:\OPT\Softwares\Anaconda\Scripts\pip-script.py' is not present.
对于该问题,在网上搜索答案,说是需要更新一下pip,但是输入pip install –upgrade pip
也报出上面的错误,于是只好重装pip ,但是在窗口输入命令:easy_install pip
(注意:必须添加python的环境变量,或者cd到easy_install所在路径)后,输入后试了一下 pip install + 包名,结果还是上述的错误,
(base) C:\Users\test>easy_install pip
Processing pip
error: Couldn't find a setup script in C:\Users\test\pip
最后尝试使用恢复pip的版本信息 easy_install -U pip==19.1.1
(base) C:\Users\test>easy_install -U pip==19.1.1
Searching for pip==19.1.1
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl#sha256=993134f0475471b91452ca029d4390dc8f298ac63a712814f101cd1b6db46676
Best match: pip 19.1.1
Processing pip-19.1.1-py2.py3-none-any.whl
Installing pip-19.1.1-py2.py3-none-any.whl to d:\opt\softwares\anaconda\lib\site-packages
Adding pip 19.1.1 to easy-install.pth file
Installing pip-script.py script to D:\OPT\Softwares\Anaconda\Scripts
Installing pip.exe script to D:\OPT\Softwares\Anaconda\Scripts
Installing pip3-script.py script to D:\OPT\Softwares\Anaconda\Scripts
Installing pip3.exe script to D:\OPT\Softwares\Anaconda\Scripts
Installing pip3.7-script.py script to D:\OPT\Softwares\Anaconda\Scripts
Installing pip3.7.exe script to D:\OPT\Softwares\Anaconda\Scripts
Installed d:\opt\softwares\anaconda\lib\site-packages\pip-19.1.1-py3.7.egg
Processing dependencies for pip==19.1.1
Finished processing dependencies for pip==19.1.1
结果就能安装成功了。如果大家遇到类似问题,可以尝试一下该方法。