Anaconda配置國內鏡像源


1. 為conda配置(清華)鏡像源

使用conda進行安裝時,訪問的是國外的網絡,所以下載和安裝包時會特別慢。我們需要更換到國內鏡像源地址,這里我更換到國內的清華大學地址。(永久添加鏡像)

Windows和Linux 對於conda修改鏡像源的方法一樣

1.添加清華鏡像:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
#設置搜索時顯示通道地址 conda config --set show_channel_urls yes

2.顯示添加的源

conda config --show channels

3.刪除指定源

conda config --remove channels 源名稱或鏈接 

2. 為pip配置國內鏡像源

2.1 配置pip鏡像源(臨時修改的方法)

可以在使用pip的時候加參數-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:

pip install numpy -i https://mirrors.aliyun.com/pypi/simple/

國內常用源鏡像地址:

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

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

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

華中理工大學:https://pypi.hustunique.com/

山東理工大學:https://pypi.sdutlinux.org/

豆瓣:https://pypi.douban.com/simple/

2.2配置pip鏡像源(永久有效)

1.Windows系統

windows下,直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容如下:

[global] index-url = https://mirrors.aliyun.com/pypi/simple/

2.Linux系統

mkdir ~/.pip cd ~/.pip vim pip.conf

內容和上面的一樣

[global] index-url = https://mirrors.aliyun.com/pypi/simple/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM