python安裝第三方庫--換鏡像源


python安裝第三方庫的tips:

用conda安裝:conda install xxx or conda install xxx.txt

用pip安裝:pip install xxx or pip install -r xxx.txt

用其他源安裝第三方庫:conda/pip install xxx -i https://pypi.mirrors.ustc.edu.cn/simple/

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

中科大源:https://pypi.mirrors.ustc.edu.cn/simple/

python工具包網址:工具包地址,用該命令安裝下載好的工具包

python安裝第三方庫--換鏡像源

1. 更換anaconda源

清華大學鏡像:清華大學鏡像

anaconda下載地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

更換倉庫鏡像源命令:

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 --set show_channel_urls yes

2. 更換pip源

在python安裝目錄的bin目錄下運行命令:

cd ~/.pip

如果不存在該文件夾則:

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

在pip.conf中添加如下內容:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

保存即配置好了pip鏡像源。

3. 以下載pytorch0.4.0為例

sudo pip install torch==0.4.0 -f https://download.pytorch.org/whl/cu90/stable

運行上述命令即可快速下載pytorch0.4.0

參考博客:

安裝Pytorch0.4.0需要填的坑


免責聲明!

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



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