anaconda 安裝鏡像源
在使用安裝 conda 安裝某些包會出現慢或安裝失敗問題,最有效方法是修改鏡 像源為國內鏡像源。 之前都選用清華鏡像源,但是2019年后已停止服務。推薦選用中科大鏡像源。
先查看已經安裝過的鏡像源,cmd窗口執行命令: conda config --show
查看配置項 channels ,如果顯示帶有 tsinghua ,則說明已安裝過清華鏡像。
channels: https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
下一步,使用 conda config --remove channels url地址刪除清華鏡像,如下命令刪除第一個。然后,依次刪除所有鏡像源
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/
添加目前可用的中科大鏡像源:
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
並設置搜索時顯示通道地址:
conda config --set show_channel_urls yes
確認是否安裝鏡像源成功,執行 conda config --show ,找到 channels 值為如下:
channels: https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ defaults
更新
經過一段時間的使用,發現中科大鏡像源有些庫也是沒有的 ┭┮﹏┭┮ ,發現豆瓣源倒是真的好用。
介紹一下豆瓣源的配置:
- 在C:\Users\Administrator\AppData\Roaming目錄下新建文件夾pip;
- 在pip文件夾下新建pip.ini文件,然后在pip.ini 里輸入
[global]
timeout = 6000
index-url =http://pypi.douban.com/simple
trusted-host = pypi.douban.com
親測有效,無論是把anconda下載到D盤還是C盤都可以。有問題歡迎留言。