Python 官方文档:入门教程 => 点击学习
昨天第一次用python画圆,当时并没有安装numpy库(导入数据包)和matplotlib库(导入图形包),于是尝试用pip安装库 首先,我先更新了pip,如下图: 顺便附上成功
昨天第一次用python画圆,当时并没有安装numpy库(导入数据包)和matplotlib库(导入图形包),于是尝试用pip安装库
首先,我先更新了pip,如下图:
顺便附上成功截图:
然后安装numpy库:
用这种常规方法安装库会出现time out,也就是超时的情况,以下是我的解决方法:
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: httpsConnectionPool(host='files.Pythonhosted.org', port=443): Read timed out.
pip --default-timeout=100 install Package
将Package替换你所需要的库就行
#例如安装scipy时使用豆瓣的源
pip install --index-url Https://pypi.douban.com/simple scipy
#使用清华大学的源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple –upgrade Tensorflow-gpu
将pip源更换到国内镜像
用pip管理工具安装库文件时,默认使用国外的源文件,因此在国内的下载速度会比较慢,可能只有50KB/s。幸好,国内的一些顶级科研机构已经给我们准备好了各种镜像,下载速度可达2MB/s。
其中,比较常用的国内镜像包括:
(1)阿里云 http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣http://pypi.douban.com/simple/
(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
以清华源为例,设置方法如下:
可以在使用pip的时候,加上参数-i和镜像地址(如 https://pypi.tuna.tsinghua.edu.cn/simple),
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
,这样就会从清华镜像安装pandas库。
成功截图如下:
同样的方法我又下载了matplotlib库:
安装完后回到python就可以导入相应的包啦
最后成功画圆啦
到此这篇关于python中pip安装库时出现Read timed out解决办法的文章就介绍到这了,更多相关pip安装出现Read timed out内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
--结束END--
本文标题: python中pip安装库时出现Read timed out解决办法
本文链接: https://www.lsjlt.com/news/141906.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0