鏡像下載、域名決議、時間同步請點擊 阿里云開源鏡像站
一、問題概述:
由于網路和時間的限制,很多的 conda 源,如 清華源,中科大源都需要想辦法才能創建好虛擬環境(如本人發現的將清華源中的 https:// 改為 http:// 之后效果好很多),但這些源要么在前幾次創建虛擬環境時奏效,時間長了仍然不管用,
二、解決方法
目前本人在用的 pip 源和 conda 源都是采用阿里源,速度很快,跑滿帶寬沒問題,
三、步驟
- ubuntu 系統:
ctrl + alt + T 打開終端(Terminal),按條復制粘貼回車下列命令:
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/r
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/msys2
conda config --set show_channel_urls yes
此時你會發現在 Home 目錄下,多了一個隱藏檔案 (按 ctrl + H 顯示) .condar 檔案,雙擊打開,可以看到:
ssl_verify: true # 是否信任當前網址, 有/無這個都可
channels:
- http://mirrors.aliyun.com/anaconda/pkgs/main
- http://mirrors.aliyun.com/anaconda/pkgs/r
- http://mirrors.aliyun.com/anaconda/pkgs/msys2
show_channel_urls: true
如果與上面的不相同,請將上面的覆寫原來的 .condar,
??之后創建環境:
conda create -n python=3.x
- windows 系統
打開 cmd 命令列:win圖示鍵 + R,輸入 cmd 回車
同樣按條復制粘貼回車下列命令:
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/r
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/msys2
conda config --set show_channel_urls yes
此時你會發現在 C:\Users\用戶名 目錄下,多了一個隱藏檔案 (按 ctrl + H 顯示) .condar 檔案,雙擊打開
channels:
- http://mirrors.aliyun.com/anaconda/pkgs/main
- http://mirrors.aliyun.com/anaconda/pkgs/r
- http://mirrors.aliyun.com/anaconda/pkgs/msys2
show_channel_urls: true
如果不是,替換掉原來的即可,
之后創建環境:
conda create -n python=3.x
四、pip 更換阿里源
本文轉自:https://blog.csdn.net/qq_38929105/article/details/123652248
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/463996.html
標籤:其他
