使用pip安装工具包时出现如下报错,提示要升级pip:
WARNING: You are using pip version 22.0.4; however, version 23.0.1 is available.
You should consider upgrading via the 'D:\downloads\apps\Anaconda3\python.exe -m pip install --upgrade pip' command.
切换路径到以上的D盘路径,切换方法为:在文件资源管理器中找到该路径,然后在路径上直接输入cmd命令,按回车即可弹出该路径下的控制台页面。
然后尝试输入以下命令升级pip:
python -m pip install --upgrade pip
发现还是出现一开始的报错,可能跟路径下文件有关:
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
WARNING: You are using pip version 22.0.4; however, version 23.0.1 is available.
You should consider upgrading via the 'D:\downloads\apps\Anaconda3\python.exe -m pip install --upgrade pip' command.
按照这位博主的方法,打算卸掉pip重装:
D:\downloads\apps\Anaconda3>python -m pip uninstall pip
Found existing installation: pip 22.0.4
Uninstalling pip-22.0.4:
Would remove:
c:\users\zoe\appdata\roaming\python\python39\scripts\pip.exe
c:\users\zoe\appdata\roaming\python\python39\scripts\pip3.9.exe
c:\users\zoe\appdata\roaming\python\python39\scripts\pip3.exe
c:\users\zoe\appdata\roaming\python\python39\site-packages\pip-22.0.4.dist-info\*
c:\users\zoe\appdata\roaming\python\python39\site-packages\pip\*
Proceed (Y/n)? y
Successfully uninstalled pip-22.0.4
执行安装代码时却又报错:
D:\downloads\apps\Anaconda3>easy_install pip
'easy_install' 不是内部或外部命令,也不是可运行的程序或批处理文件。
继续查询发现,可以按照这篇博客的方法修正,不同的是我执行了第一行代码就能成功安装最新版的pip了:
D:\downloads\apps\Anaconda3>python -m ensurepip
Looking in links: c:\Users\Zoe\AppData\Local\Temp\tmprnrwmn9m
Requirement already satisfied: setuptools in d:\downloads\apps\anaconda3\lib\site-packages (58.0.4)
Requirement already satisfied: pip in d:\downloads\apps\anaconda3\lib\site-packages (23.0.1)