Anaconda更新一直報錯,修改為國內鏡像也不好使,最終找到了未被屏蔽的鏡像。
錯誤日志:
UnavailableInvalidChannel: The channel is not accessible or is invalid. channel name: simple channel url: http://pypi.douban.com/simple error code: 404
意思是資源路徑無效或無法訪問;資源的url地址是 http://pypi.douban.com/simple,錯誤代碼是404。
404是指鏈接指向的網頁不存在,即原始網頁的URL失效。
解決辦法:
1.首先恢復配置: conda config --remove-key channels
conda config --remove-key channels
2.再配置鏡像: Anaconda 2019-12-17目前可使用鏡像:https://repo.continuum.io/pkgs/free/win-64/ https://repo.continuum.io/pkgs/main/win-64/
conda config --add channels https://repo.continuum.io/pkgs/free/win-64/
conda config --add channels https://repo.continuum.io/pkgs/main/win-64/
conda config --set show_channel_urls yes
3.查看配置信息:
conda config --show channels
pip源修改為國內鏡像
國內鏡像:
阿里雲 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/
修改源方法:
臨時使用:
可以在使用pip的時候在后面加上-i參數,指定pip源
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
永久修改:
linux:
修改 ~/.pip/pip.conf (沒有就創建一個), 內容如下:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
windows:
直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,在pip 目錄下新建文件pip.ini,內容如下
或者按照網友的建議:win+R 打開用戶目錄%HOMEPATH%,在此目錄下創建 pip 文件夾,在 pip 目錄下創建 pip.ini 文件, 內容如下
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
參考清華大學鏡像配置
備注:
作者:Sm Zeng
博客:http://www.cnblogs.com/zengming/
嚴正聲明:
1.由於本博客部分資源來自互聯網,版權均歸原作者所有。轉載的目的是用於學術交流與討論學習,將不對任何資源負法律責任。
2.若無意中侵犯到您的版權利益,請來信聯系我,我會在收到信息后會盡快給予處理!
3.所有資源內容僅供學習交流之用,請勿用作商業用途,謝謝。
4.如有轉發請注明出處,來源於http://www.cnblogs.com/zengming/,謝謝合作。