快速安裝python相關包&避免Read timed out

正常使用pip install 進行軟件安裝非常的慢,這是因爲我們是從國外網站上下載的,在國內,我們可以通過國內鏡像快速下載:
舉一個栗子:
我現在要下載TensorFlow1.12.0版本:
pip3 install tensorflow==1.12.0

將其改寫爲:
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ tensorflow==1.12.0

如果你的網速太太太慢了仍然會下載超時,可以試一下:
pip3 --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple/tensorflow==1.12.0
將100改的越大,就越能避免Read timed out,但是調到1000還不能正常下載完,以我的經驗來看,那基本上就應該另闢蹊徑了。

如果要下載最新版本的,可以去掉對版本的約束:
pip3 --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple/tensorflow

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章