目录
无论是在 Ubuntu 还是 Window 下使用 pip 安装第三方库时,都有可能遇到超时问题,导致下载中断,并提示:ReadTimeoutError: HTTPSConnectionPool (host=‘files.pythonhosted.org’, port=443): Read timed out. 等错误信息。
超时的主要原因在于 网络连接不稳定。由于经常出现该问题,但又有些忘记命令了,所以最后索性小结记录一下。
以下以安装 catboost 为例,指出若干解决方式。实际使用时,改为自己需要下载的库名即可。
法一:指定下载源
使用常用的国内源下载,例如:
清华源:
pip install catboost -i https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣源:
pip install catboost -i https://pypi.douban.com/simple
</