pip、conda更換國內下載源

工欲善其事,必先利其器。想要作爲一名合格的python“調包俠”,如果連包都下載不下來還玩什麼呢?

一、更換pip的下載源

國內一般使用:

清華大學:https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣:http://pypi.douban.com/simple/
阿里雲:http://mirrors.aliyun.com/pypi/simple/

  1. 打開用戶家目錄
    使用win+R,輸入%USERPROFILE%,回車
    在這裏插入圖片描述
    在這裏插入圖片描述
  2. 新建pip目錄,並新建pip.ini文件
    填入如下內容並保存

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

在這裏插入圖片描述

二、更換conda的下載源

國內一般使用中科大、清華、上交

中科大:https://mirrors.ustc.edu.cn
清華:https://mirrors.tuna.tsinghua.edu.cn
上海交通大學:https://mirrors.sjtug.sjtu.edu.cn

  1. 配置文件編輯
    使用win+R,輸入%USERPROFILE%,回車,在打開的文件夾下查找.condar文件並編輯。
    (如果找不到的話,可以先設置下載源,打開conda prompt輸入下方配置,然後就能看到配置文件了):
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

根據你的網絡,配置對應的下載源:

channels:
 1. https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
 2. https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 3. https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true

如下圖
在這裏插入圖片描述

  1. 如果想恢復成默認下載源,只需要打開conda prompt輸入:
conda config --remove-key channels
附:

1、miniconda下載地址 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章