升级pip报错ERROR: Could not install packages due to an OSError: [WinError 5]
今天在安装python第三方库时,提示pip需要升级,没有多想直接升级,结果报错:
1 ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'd:\\python\\scripts\\pip.exe'
2 Consider using the `--user` option or check the permissions.
一、报错处理
从报错信息看,大概是权限问题,于是使用管理员身份运行CMD,再次升级依旧报错。
D:\Python\Lib\site-packages>pip install --upgrade pip
Requirement already satisfied: pip in d:\python\lib\site-packages (21.1.1)
Collecting pip
Downloading pip-23.0.1-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 2.2 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.1
Uninstalling pip-21.1.1:
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'd:\\python\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
升级时PyCharm未关闭,联想到之前处理过的报错,查看了 D:\Python\Lib\site-packages 目录,果然pip
相关的两个文件夹已经不在了。此时执行命令报错:
D:\Python\Lib\site-packages>pip install --upgrade pip
Traceback (most recent call last):
File "d:\python\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
最终解决方法,先执行 python -m ensurepip 命令,再升级pip。
D:\Python\Lib\site-packages>python -m ensurepip
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Looking in links: c:\Users\EDISON~1\AppData\Local\Temp\tmphubo0umq
Requirement already satisfied: setuptools in d:\python\lib\site-packages (56.0.0)
Processing c:\users\edisonyao\appdata\local\temp\tmphubo0umq\pip-21.1.1-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Installing collected packages: pip
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Successfully installed pip-21.1.1
D:\Python\Lib\site-packages>python -m pip install --upgrade pip
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Requirement already satisfied: pip in d:\python\lib\site-packages (21.1.1)
Collecting pip
Using cached pip-23.0.1-py3-none-any.whl (2.1 MB)
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Installing collected packages: pip
Attempting uninstall: pip
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Found existing installation: pip 21.1.1
Uninstalling pip-21.1.1:
Successfully uninstalled pip-21.1.1
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
Successfully installed pip-23.0.1
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\python\lib\site-packages)
二、命令释义
ensurepip 包为在已有的Python安装实例或虚拟环境中引导 pip 安装器提供了支持。需要使用引导才能使
用pip的这一事实也正好反映了 pip 是一个独立的项目,有其自己的发布周期,其最新版本随CPython解释器的
维护版本和新特性版本一同捆绑。
在大多数情况下,Python的终端使用者不需要直接调用这个模块( pip 默认应该已被引导),不过,如果
在安装Python(或创建虚拟环境)时跳过了安装 pip 步骤,或者使用过程中卸载了 pip ,则需要使用这个模块。
最常用的调用命令: python -m ensurepip ,其含义是在未安装pip的情况下安装pip,若已安装则不做任
何处理。
升级pip报错ERROR: Could not install packages due to an OSError: [WinError 5]的更多相关文章
- python下载报错:Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问
更新pip模块的版本:python -m pip install --upgrade pip 但是遇到报错提示: Could not install packages due to an Enviro ...
- ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问
报错:ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问.: 'E:\\Anoconda\\ ...
- 安装xlrd包的时候,总是报错:ERROR: Could not install packages due to an EnvironmentError: HTTPConnectionPool (host='127.0.0.1', port=8888):。。。
安装xlrd包的时候,总是报错:ERROR: Could not install packages due to an EnvironmentError: HTTPConnectionPool (ho ...
- android sdk启动报错error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037:
android sdk启动报错error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 问题原因: ...
- ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous' Consider using the `--user` option or check the permissions
近期练习flask写个blog, 安装flask扩展时 pip install Flask-WTF 报ERROR: Could not install packages due to an Envir ...
- python3升级pip报错ImportError: cannot import name 'main'
把系统的python版本从默认的2切换到3后,使用pip3安装依赖报错,如下: Traceback (most recent call last): File , in <module> ...
- Sublime Text3 安装 markdownediting插件 报错 Error loading syntax file "Packages/Markdown/Markdown.tmLanguage":
问题: Error loading syntax file "Packages/Markdown/Markdown.sublime-syntax": 解决方法: ./Data/Lo ...
- pip安装django出错 Could not install packages due to an EnvironmentError: [Errno 13]
pip install django 下载安装Django报错, 按照提示的建议改为 pip install --user django 安装完成
- Win10安装Tensorflow-gpu遇到Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问
最近因为上课需要安装Anaconda和Tensorflow,安装Anaconda后再使用 Tensorflow官网提供的pip安装Tensorflow-GPU方法会出现如下错误: 解决方法:在安装命令 ...
- [已解决]报错: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Users/mac/Ana
报错代码: pip3 install gerapy 报错内容: Could not install packages due to an EnvironmentError: [Errno 13] Pe ...
随机推荐
- CVPixelBufferRef
在iOS里,我们经常能看到 CVPixelBufferRef 这个类型,在Camera 采集返回的数据里得到一个CMSampleBufferRef,而每个CMSampleBufferRef里则包含一个 ...
- 【JavaScript】JS写法随笔(三) JS联动设置元素默认值
问题: 使用DOM获取元素后setAttribute("value", "1")在页面有修改此标签value的情况下,再次触发function发生不生效.无法修 ...
- MySQL8.0使用GROUP BY的问题
当使用group by的语句中,select后面跟的列,在group by后面没有时,会报以下错误: Expression #2 of SELECT list is not in GROUP BY c ...
- 在CentOS下安装nginx+php环境
一.nginx 安装 1. 在nginx官网下载nginx源码 提供一个nginx官网下载地址: http://nginx.org/download/nginx-1.12.2.tar.gz 注意:请先 ...
- SaltStack学习笔记
SaltStack三大功能: 1. 远程执行 2. 配置管理 (状态) 3.云管理 运维三板斧:监控.执行.配置 四种运行方式: 1.Local 2. Minion/Master C/S架构 3 ...
- Filbeat采集nginx-ingress日志
一.创建configmap配置文件 注:filebeat6以上版本需要将prospectors改为inputs,paths下指定的nginx-ingress日志路径匹配模式以及hosts指定的kafk ...
- C语言历史与C++的区别
前期演变: C语言的前身是1967年由Martin Richards为开发操作系统和编译器而提出的两种高级程序设计语言BCPL和B.BCPL.Ken Thompson在BCPL的基础上,提出了新的功能 ...
- requests模块获取cookie -----class 'requests.cookies.RequestsCookieJar'
#coding=utf-8 import requests url="http://www.baidu.com" response=requests.get(url) cookie ...
- Linux下 Jdk版本切换
安装: 甲骨文官网下jdk 上传到云服务器 解压: tar -zxvf jdk-7u79-linux-x64.tar.gz 设置环境变量 vim /etc/profile 末尾加上 export JA ...
- kubectl命令详解
一.kubectl 基本命令 1.陈述式资源管理方法: 1.kubernetes集群管理集群资源的唯一入口是通过相应的方法调用apiserver的接口 2.kubectl 是官方的CLI命令行工具,用 ...