pip 安裝超時問題解決方案

我們用默認pip源進行安裝第三方模塊時,經常會碰到超時問題,下面是解決方案

首先在下面文件夾下建立一個pip文件夾

C:\Users\Administrator\AppData\Roaming

然後在pip文件夾下新建一個文件pip.ini,內容:

[global]
timeout = 60000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
use-mirrors = true
mirrors = https://pypi.tuna.tsinghua.edu.cn

這樣就把pip安裝源改成國內的了,速度很快

ps:還可單次使用國內源

設置超時時間:pip --default-timeout=100 install  Pillow

不使用緩存:pip  --no-cache-dir install Pillow

使用國內源:pip install web.py -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

阿里雲 http://mirrors.aliyun.com/pypi/simple/

中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/ 

豆瓣(douban) http://pypi.douban.com/simple/ 

清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/

中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/

 

但是經過網上給的方法進行安裝,還是出現錯誤
在這裏插入圖片描述
主要意思就是位於pypi.douban.com的存儲庫不是受信任的或安全的主機,正在被忽略。
要求使用“–trusted host pypi.douban.com”允許此警告。


所以最終的

解決辦法:pip install keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com(其中的keras是你需要下載的,根據自己需求自行更改)
 

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