回到顶部

阅读目录

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 <module>
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

 

^_^
请喝咖啡 ×

本作品由 卓越笔记 采用 知识共享署名 - 非商业性使用 - 相同方式共享 4.0 国际许可协议 进行许可

前一篇: Django + djcelery + redis 执行异步任务
下一篇: Django + celery + redis 执行异步任务及查看结果(推荐)