1、使用pip安裝第三方庫過慢導致超時無法安裝:
pip install reportlab
出現異常:
socket.timeout: The read operation timed out
2、 原因:
pip下載的時國外的資源,速度過慢,應該切換至國內鏡像
3、解決方法:
更換 pip 源自國內鏡像,在 pip install 后面添加 -i https://pypi.tuna.tsinghua.edu.cn/simple
上面藍色部分是鏡像地址,網上可以查到,這里提供兩個速度快的:
豆瓣:http://pypi.douban.com/simple/
清華:https://pypi.tuna.tsinghua.edu.cn/simple
4、使用示例:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple reportlab