python 永久解决pip 访问失败问题
2021/9/9 14:33:59
本文主要是介绍python 永久解决pip 访问失败问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
背景
想要使用python完成爬虫,故而需要搭建环境
pip命令
>pip install pyspider
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission d enied'))': /simple/pyspider/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission d enied'))': /simple/pyspider/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission d enied'))': /simple/pyspider/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission d enied'))': /simple/pyspider/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission d enied'))': /simple/pyspider/ ERROR: Could not find a version that satisfies the requirement pyspider (from versions: none) ERROR: No matching distribution found for pyspider
报错原因
PIP镜像仓库访问不到
临时解决
# 临时使用 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider
持久解决
配置镜像仓库
需配置其中一个即可
## 配置中科大镜像 pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple # 配置阿里源 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # 配置腾讯源 pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple # 配置豆瓣源 pip config set global.index-url http://pypi.douban.com/simple/
执行配置之后,会把配置文件写到指定的路径下
默认路径为: %AppData%\pip\pip.ini
再次执行
pip install pyspider
将镜像源设置为信任
在默认的pip.ini中 增加配置
[global] index-url = http://pypi.douban.com/simple/ trusted-host = pypi.douban.com
正常执行
这篇关于python 永久解决pip 访问失败问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-14获取参数学习:Python编程入门教程
- 2024-11-14Python编程基础入门
- 2024-11-14Python编程入门指南
- 2024-11-13Python基础教程
- 2024-11-12Python编程基础指南
- 2024-11-12Python基础编程教程
- 2024-11-08Python编程基础与实践示例
- 2024-11-07Python编程基础指南
- 2024-11-06Python编程基础入门指南
- 2024-11-06怎么使用python 计算两个GPS的距离功能-icode9专业技术文章分享