
使用pip install 某些模块发生安装错误:
Traceback (most recent call last):
File "d:\python3.7.4\lib\site-packages\pip_vendor\urllib3\response.py", line 425, in _error_catcher
yield
File "d:\python3.7.4\lib\site-packages\pip_vendor\urllib3\response.py", line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "d:\python3.7.4\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "d:\python3.7.4\lib\http\client.py", line 457, in read
n = self.readinto(b)
File "d:\python3.7.4\lib\http\client.py", line 501, in readinto
n = self.fp.readinto(b)
File "d:\python3.7.4\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "d:\python3.7.4\lib\ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "d:\python3.7.4\lib\ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
到网上搜了很多方法,包括使用管理员权限,修改pip main 方法,都不行,后来我想应该就是简单的网速低导致断链的问题吧?pip可能不支持断点续传。
解决方法:
替换镜像地址
<small style="font-size: 12pxletter-spacing: normalcolor: rgb(171, 171, 171)display: blocktext-align: rightfont-family: Verdana, "Lucida Grande", Geneva, Arial, sans-seriffont-style: normalfont-variant-ligatures: normalfont-variant-caps: normalfont-weight: 400orphans: 2text-indent: 0pxtext-transform: nonewhite-space: normalwidows: 2word-spacing: 0px-webkit-text-stroke-width: 0pxbackground-color: rgb(255, 255, 255)text-decoration-style: initialtext-decoration-color: initial">2019-07-04 10:55 微风阳光 阅读(12968) 评论(1) 编辑 [收藏](javascript:void(0))</small>
国内镜像源
清华: https://pypi.tuna.tsinghua.edu.cn/simple
阿里云: http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学: http://pypi.hustunique.com/
山东理工大学: http://pypi.sdutlinux.org/
豆瓣: http://pypi.douban.com/simple/
临时使用
在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。
一劳永逸
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
|
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
|
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。
本机win10 *** 作系统,目录:C:\Users\DELL\AppData\Roaming\pip\pip.ini
遇到的问题
实际使用的时候,一开始使用清华的镜像,在安装时,总是提示
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
换了阿里的镜像之后,问题得到了解决。
Debian Linux应该满足你的要求。它的软件仓库内软件丰富。如果你是中国的大学生,或者你是教育网用户,Debian更加适合你。Debian Linux的获取和升级是免费的,你的花费只是下载软件的网络流量费。其官方网站是
http://www.debian.org/
系统的安装方法在
http://www.ideawu.net/debian3install.html
http://zhidao.baidu.com/question/7349300.html
下载地址在:
* 1. 中国科技大学上的安装光盘 ftp://debian.ustc.edu.cn/debian-cd/images/current/debian-31r0a-i386-binary-1.iso
* 2. 大连理工大学上的安装光盘 http://mirror.dlut.edu.cn/debian-cd/3.1/debian-31r0a-i386-binary-1.iso
* 3. cn99.com上的安装光盘 http://debian.cn99.com/debian-cd/debian-31r0a-i386-binary-1.iso
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)