python pip和conda 配置

pip

Windows

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

[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

注:url

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

Linux

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

~/.pip/pip.conf

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

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

[install]
trusted-host=mirrors.aliyun.com

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

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

conda

設置清華大學鏡像:ci

conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda config --set show_channel_urls yes

參考:清華大學開源軟件鏡像站get

相關文章
相關標籤/搜索