python卸载pip_python3 不小心 卸载了 pip,重装 pip 办法

日志记录

1. 手残了,多打了 pip,而且还没看提示,一路 Y(Mac OS)

(joyoo) yinzhuoqundeMacBook-Pro:joyoo yinzhuoqun$ pip uninstall pip install django-celery-results

Uninstalling pip-19.3.1:

Would remove:

/Users/yinzhuoqun/.pyenv/joyoo/bin/pip

/Users/yinzhuoqun/.pyenv/joyoo/bin/pip3

/Users/yinzhuoqun/.pyenv/joyoo/bin/pip3.6

/Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages/pip-19.3.1.dist-info/*

/Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages/pip/*

Proceed (y/n)? y

Successfully uninstalled pip-19.3.1

WARNING: Skipping install as it is not installed.

Uninstalling django-celery-results-1.1.2:

Would remove:

/Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages/django_celery_results-1.1.2.dist-info/*

/Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages/django_celery_results/*

Proceed (y/n)?

Your response ('') was not one of the expected responses: y, n

Proceed (y/n)? y

Successfully uninstalled django-celery-results-1.1.2

(joyoo) yinzhuoqundeMacBook-Pro:joyoo yinzhuoqun$ pip uninstall django-celery-results

-bash: /Users/yinzhuoqun/.pyenv/joyoo/bin/pip: No such file or directory

(joyoo) yinzhuoqundeMacBook-Pro:joyoo yinzhuoqun$ pip

-bash: /Users/yinzhuoqun/.pyenv/joyoo/bin/pip: No such file or directory

2. 升级 pip 因目录或文件权限问题,卸载了旧版 pip 但是没装上新版 pip(Windows)

(joyoo) E:\yinzhuoqun\djangos\joyoo>pip install --upgrade pip

Collecting pip

Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB)

|████████████████████████████████| 1.5 MB 29 kB/s

Installing collected packages: pip

Attempting uninstall: pip

Found existing installation: pip 20.0.2

Uninstalling pip-20.0.2:

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'e:\\py_virtualenv\\joyoo\\scripts\\pip.exe'

Consider using the `--user` option or check the permissions.

(joyoo) E:\yinzhuoqun\djangos\joyoo>pip uninstall djangorestframework

Traceback (most recent call last):

File "d:\program files\python36\Lib\runpy.py", line 193, in _run_module_as_main

"__main__", mod_spec)

File "d:\program files\python36\Lib\runpy.py", line 85, in _run_code

exec(code, run_globals)

File "E:\py_virtualenv\joyoo\Scripts\pip.exe\__main__.py", line 4, in

ModuleNotFoundError: No module named 'pip'

重装 pip

Mac: cd 到 该 python 环境的 bin 目录(/Users/yinzhuoqun/.pyenv/joyoo/bin)

执行:./easy_install pip

yinzhuoqundeMacBook-Pro:bin yinzhuoqun$ ./easy_install pip

Searching for pip

Reading https://pypi.org/simple/pip/

Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl#sha256=6917c65fc3769ecdc61405d3dfd97afdedd75808d200b2838d7d961cebc0c2c7

Best match: pip 19.3.1

Processing pip-19.3.1-py2.py3-none-any.whl

Installing pip-19.3.1-py2.py3-none-any.whl to /Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages

Adding pip 19.3.1 to easy-install.pth file

Installing pip script to /Users/yinzhuoqun/.pyenv/joyoo/bin

Installing pip3 script to /Users/yinzhuoqun/.pyenv/joyoo/bin

Installing pip3.7 script to /Users/yinzhuoqun/.pyenv/joyoo/bin

Installed /Users/yinzhuoqun/.pyenv/joyoo/lib/python3.6/site-packages/pip-19.3.1-py3.6.egg

Processing dependencies for pip

Finished processing dependencies for pip

Windows:cd 到 该 python 环境的 Scripts 目录

执行:easy_install.exe pip

(joyoo) E:\py_virtualenv\joyoo\Scripts>easy_install.exe pip

Searching for pip

Reading https://pypi.org/simple/pip/

Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl#sha256=b27c4dedae8c41aa59108f2fa38bf78e0890e590545bc8ece7cdceb4ba60f6e4

Best match: pip 20.1.1

Processing pip-20.1.1-py2.py3-none-any.whl

Installing pip-20.1.1-py2.py3-none-any.whl to e:\py_virtualenv\joyoo\lib\site-packages

Adding pip 20.1.1 to easy-install.pth file

Installing pip-script.py script to e:\py_virtualenv\joyoo\Scripts

Installing pip.exe script to e:\py_virtualenv\joyoo\Scripts

Installing pip3-script.py script to e:\py_virtualenv\joyoo\Scripts

Installing pip3.exe script to e:\py_virtualenv\joyoo\Scripts

Installing pip3.8-script.py script to e:\py_virtualenv\joyoo\Scripts

Installing pip3.8.exe script to e:\py_virtualenv\joyoo\Scripts

Installed e:\py_virtualenv\joyoo\lib\site-packages\pip-20.1.1-py3.6.egg

Processing dependencies for pip

Finished processing dependencies for pip

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值