前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows pip upgrade 报错 No module named 'pip'

Windows pip upgrade 报错 No module named 'pip'

作者头像
为为为什么
发布2022-08-05 10:41:16
8820
发布2022-08-05 10:41:16
举报
文章被收录于专栏:又见苍岚

windws 10 下升级 pip ,升级时下载安装包,卸载原有pip成功,在安装新pip包时因种种原因安装失败会导致pip被卸载,本文记录修复方法 。

常见原因

  • Windows 中anaconda文件夹没有为users用户开放全部控制权限
  • 在更新pip时命令为(这是错误的命令):
代码语言:javascript
复制
pip install -U pip

此时pip从服务器下载了最新的pip安装包,卸载了原来的pip,但是没有权限安装新的pip 导致使用此命令更新pip后无pip可用

正确命令shell

  • 在选项中加入 --user
代码语言:javascript
复制
pip install --upgrade pip --user

修复命令

  • 如果不慎中招,可以使用如下命令恢复
代码语言:javascript
复制
python -m ensurepip
python -m pip install --upgrade pip

实际效果

代码语言:javascript
复制
$ pip list
Traceback (most recent call last):
  File "e:\program_files\annoconda\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\program_files\annoconda\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Program_Files\Annoconda\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

$ python -m ensurepip
Looking in links: C:\Users\Admin\AppData\Local\Temp\tmp1ggp6o2t
Requirement already satisfied: setuptools in e:\program_files\annoconda\lib\site-packages (45.1.0)
Collecting pip
jupyterlab 2.1.0 has requirement jupyterlab_server>=1.1.0, but you'll have jupyterlab-server 1.0.0 which is incompatible.
jupyterlab-server 1.0.0 has requirement jsonschema>=3.0.1, but you'll have jsonschema 2.6.0 which is incompatible.
imgviz 1.1.0 has requirement Pillow>=5.3.0, but you'll have pillow 5.2.0 which is incompatible.
Installing collected packages: pip
Successfully installed pip-10.0.1

$ python -m pip install --upgrade pip
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting pip
  Using cached https://mirrors.aliyun.com/pypi/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl
jupyterlab 2.1.0 has requirement jupyterlab_server>=1.1.0, but you'll have jupyterlab-server 1.0.0 which is incompatible.
jupyterlab-server 1.0.0 has requirement jsonschema>=3.0.1, but you'll have jsonschema 2.6.0 which is incompatible.
imgviz 1.1.0 has requirement Pillow>=5.3.0, but you'll have pillow 5.2.0 which is incompatible.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-20.1.1
You are using pip version 20.1.1, however version 20.2b1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020年5月30日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 常见原因
  • 正确命令shell
  • 修复命令
  • 实际效果
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档