卸载PIP 时报警PermissionError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.5/dist-packages/pip

一.问题描述

卸载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安装即可.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值