python conda 安裝和國內(nèi)鏡像加速

[TOC]

沒開加速

CondaHTTPError: HTTP None None for url <None>
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
SSLError(SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),),)

即使配置了 pip 國內(nèi)鏡像,仍然報(bào)錯,肯定是網(wǎng)絡(luò)問題

配置國內(nèi)鏡像

  • 檢查當(dāng)前配置
conda config --show

默認(rèn)還是使用 repo.continuum.io 的源

直接修改 ~/.condarc 配置文件

vim ~/.condarc

添加內(nèi)容

USTC Anaconda 鏡像停止服務(wù)
中科大源

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/

conda config --set show_channel_urls yes 

tsinghua 關(guān)于停止Anaconda鏡像服務(wù)的通知

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

然后再用 conda config --show 復(fù)查配置

$ conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
allow_softlinks: True
always_copy: False
always_softlink: False
always_yes: False
auto_update_conda: True
binstar_upload: None
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
  - defaults
client_ssl_cert:
client_ssl_cert_key:
create_default_packages: []
debug: False
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
disallow: []
.....

刪除源

conda config --remove-key $channels

安裝 miniconda

macOS 安裝Miniconda

miniconda 官方文檔 https://conda.io/miniconda.html

  • 安裝 conda by brew
brew install brew-cask
brew cask info caskroom/cask/miniconda
brew cask install caskroom/cask/miniconda

二進(jìn)制安裝
miniconda 文件下載鏈接 https://repo.continuum.io/miniconda/
配置環(huán)境變量

.bash_profile

# caskroom/cask/miniconda
MINI_CONDA_BIN=~/miniconda3/bin/
export MINI_CONDA_BIN
export PATH=$PATH:$MINI_CONDA_BIN
  • 注意:

使用conda list命令的環(huán)境時(shí)python版本切換到anaconda版本下,不然,無法使用

anaconda的環(huán)境下,也是只能使用系統(tǒng)pip命令安裝插件包

Ubuntu 安裝和卸載Anaconda 、Miniconda

miniconda 官方文檔 https://conda.io/miniconda.html
miniconda 文件下載鏈接 https://repo.continuum.io/miniconda/
anaconda 的下載https://www.continuum.io/downloads

# 安裝
bash Miniconda3-latest-Linux-x86_64.sh
conda --version
conda list

卸載anaconda的步驟

rm -rf anaconda/文件夾名
# 清理下.bashrc中的Anaconda路徑
# 關(guān)閉終端,然后再重啟一個(gè)新的終端,這一步很重要,不然在原終端上還是綁定有anaconda
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容