CentOS 7.5 安裝Anaconda以及conda換源


下載安裝包

可以從Anaconda官網中下載安裝包

https://www.anaconda.com/distribution/

由於網絡原因,從官網下載較慢,可以選擇從清華鏡像中下載

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh

下載完成后,添加執行權限

chmod a+x Anaconda3-5.3.1-Linux-x86_64.sh

安裝

./Anaconda3-5.3.1-Linux-x86_64.sh

# ENTER
# yes 接受許可證
# 選擇目錄

可能會報錯

./Anaconda3-5.3.1-Linux-x86_64.sh:行353: bunzip2: 未找到命令
tar: 它似乎不像是一個 tar 歸檔文件
tar: 由於前次錯誤,將以上次的錯誤狀態退出

使用yum安裝bzip2即可

yum install bzip2 -y

刪除剛才的安裝目錄,重新安裝

安裝最后可以選擇yes修改.bashrc,添加環境變量,根據自己需要選擇是否安裝VSCode

以下是Anaconda添加的內容

# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/root/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/root/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/root/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

也可以自己修改~/.bashrc中的內容

vim ~/.bashrc
# 添加以下內容
export PATH=$PATH:/root/anaconda3/bin #根據具體路徑添加
# 最后重啟終端或
source ~/.bashrc
conda -V 
conda 4.5.11

conda換源

可以參考以下鏈接

https://www.jianshu.com/p/042fd657e2d4

https://mirror.tuna.tsinghua.edu.cn/help/anaconda/

Miniconda 鏡像使用幫助

Miniconda 是一個 Anaconda 的輕量級替代,默認只包含了 python 和 conda,但是可以通過 pip 和 conda 來安裝所需要的包。

Miniconda 安裝包可以到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/ 下載。


免責聲明!

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



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