一.问题描述
卸载PIP 时报警:
joes@joes:~$ python -m pip uninstall pip
DEPRECATION: Uninstalling a distutils installed project (pip) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pip-8.0.2:
/usr/local/lib/python3.5/dist-packages/pip-8.0.2.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.5/shutil.py", line 538, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/pip-8.0.2.egg-info' -> '/tmp/pip-5hg22u8b-uninstall/usr/local/lib/python3.5/dist-packages/pip-8.0.2.egg-info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/dist-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_set.py", line 325, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_install.py", line 752, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 266, in renames
shutil.move(old, new)
File "/usr/lib/python3.5/shutil.py", line 553, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/pip-8.0.2.egg-info'
You are using pip version 8.0.2, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
二.问题解决
查看路径:PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/pip-8.0.2.egg-info',
找到以上你自己报警的位置,找到该文件,在该文件目录打开终端.执行:
sudo rm pip-8.0.2.egg-info
删除成功后,再次执行PIP安装即可.