
使用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.
换了阿里的镜像之后,问题得到了解决。
Homebrew (官网) 是一款包管理工具,目前支持macOS和Linux系统。主要有四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles。
Homebrew官方安装脚本:
但 raw.githubusercontent.com 访问不稳定,如果等待一段时间后遇到下面提示,就说明无法访问官方脚本地址
我们可以提前设置homebrew-core镜像源并通过jsdelivr CDN加速脚本安装:
或者参考下清华镜像站的 Homebrew/Linuxbrew 镜像使用帮助 ,这里节约些安装的篇幅。
官方源是 https://github.com/Homebrew/homebrew-xxx.git ,由于 实在太慢了 我们基本不用。
清华镜像站同时提供 Homebrew 的 formula 索引的镜像(即 brew update 时所更新内容)。
*** 作说明 :设置环境变量 HOMEBREW_BOTTLE_DOMAIN ,值为 https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles 。
中国科大开源软件镜像站:https://mirrors.ustc.edu.cn/
清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/
阿里云Homebrew源:https://mirrors.aliyun.com/homebrew
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)