python3 不小心 卸载了 pip,重装 pip 办法
2023-03-07 09:47:00 时间
日志记录
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
相关文章
- 图像处理工具Python扩展库,你了解吗?
- 十个常用的损失函数解释以及Python代码实现
- 30 个数据科学工作中必备的 Python 包
- 如何在 Windows 上安装 Python
- 几行 Python 代码就可以提取数百个时间序列特征
- 使用Python快速搭建接口自动化测试脚本实战总结
- 哪种编程语言最适合开发网页抓取工具?
- 不要在 Python 中使用循环,这些方法其实更棒!
- 震惊!用Python探索《红楼梦》的人物关系!
- 如何最简单、通俗地理解Python模块?
- 酷炫,Python实现交通数据可视化!
- 为什么急于寻找Python的替代者?
- 30 个数据工程必备的Python 包
- 去字节面试被面这题能答上来吗?谈谈你对时间轮的理解?
- 火山引擎在行为分析场景下的 ClickHouse JOIN 优化
- 用Python爬取了某宝1166家月饼数据进行可视化分析,终于找到最好吃的月饼~
- 在 Linux 上试试这个基于 Python 的文件管理器
- Python列表解析式到底该怎么用?
- 如何快速把你的 Python 代码变为 API
- 十个Python初学者常犯的错误