python-源管理 pip & conda

更換pip源:

一、在windows文件管理器中,輸入 %APPDATA%html

二、在該目錄下新建pip文件夾,而後到pip文件夾裏面去新建個pip.ini文件docker

三、在新建的pip.ini文件中輸入如下內容vim

[global]
timeout = 6000
trusted-host = pypi.douban.com
 

更換conda源:

一、在cmd下輸入:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
二、在cmd下輸入:conda config --set show_channel_urls yes

 

pip

Windows

Windows 下的 pip 配置文件路徑:%HOMEPATH%/pip/pip.ini 文件,如不存在則新建,在其中寫入:windows

[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com disable-pip-version-check = true timeout = 120  [install] ignore-installed = true # 不自動安裝依賴的時候設置此選項 # no-dependencies = yes  [list] format = columns

注:bash

  • index-url - 使用豆瓣源
  • format - 當運行 pip list 命令時,等效於 pip list --format=columns,避免出現相關警告。

Linux

Linux 系統pip配置文件默認路徑爲:post

~/.pip/pip.conf

若是用的阿里雲,則默認配置文件爲:ui

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

可是阿里雲pypi更新比較緩慢,換成註釋掉相關配置,換成官方源。
另附清華源配置:阿里雲

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

conda

設置清華大學鏡像:url

conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' conda config --set show_channel_urls yes
相關文章
相關標籤/搜索