Anaconda 安裝與卸載



Anaconda是一個免費開源的Python和R語言的發行版本,用於計算科學(數據科學、機器學習、大數據處理和預測分析),Anaconda致力於簡化軟件包管理系統和部署。Anaconda的包使用軟件包管理系統Conda進行管理。超過1200萬人使用Anaconda發行版本,並且Anaconda擁有超過1400個適用於Windows、Linux和MacOS的數據科學軟件包。 -wikipedia

安裝

  • 下載

  • 安裝(Linux)

    • 授權並執行

      # 給下載的sh文件執行權限
      chmod a+x Anaconda3-2021.05-Linux-x86_64.sh
      # 執行安裝文件
      ./Anaconda3-2021.05-Linux-x86_64.sh
      
    • 安裝輸出日志

      Welcome to Anaconda3 2021.05
      
      In order to continue the installation process, please review the license
      agreement.
      Please, press ENTER to continue
      >>>     按回車鍵(ENTER)繼續
      ===================================
      End User License Agreement - Anaconda Individual Edition
      ===================================
      
      Copyright 2015-2021, Anaconda, Inc.
      
      All rights reserved under the 3-clause BSD License:
      ...
      ... license日志
      ...
      
      
      The following packages listed on https://www.anaconda.com/cryptography are inclu
      ded in the repository accessible through Anaconda Individual Edition that relate
      to cryptography.
      
      Last updated April 5, 2021
      
      Do you accept the license terms? [yes|no]
      [no] >>>   yes (yes接受繼續,no拒絕退出安裝)
      
      Anaconda3 will now be installed into this location:
      /home/noname/anaconda3
      
      - Press ENTER to confirm the location
      - Press CTRL-C to abort the installation
      - Or specify a different location below
      
      [/home/noname/anaconda3] >>> /usr/envs/anaconda3  (此處可自定義安裝路徑,不填則為默認路徑,一般在用戶根目錄)
      PREFIX=/usr/envs/anaconda3
      Unpacking payload ...
      Collecting package metadata (current_repodata.json): done                       
      Solving environment: done
      
      ## Package Plan ##
      
      environment location: /usr/envs/anaconda3
      
      added / updated specs:
          - _ipyw_jlab_nb_ext_conf==0.1.0=py38_0
          - _libgcc_mutex==0.1=main
          - alabaster==0.7.12=pyhd3eb1b0_0
      ...
      ... anaconda基礎環境包安裝日志
      ...
      
      
      Preparing transaction: done
      Executing transaction: done
      installation finished.
      Do you wish the installer to initialize Anaconda3
      by running conda init? [yes|no]
      [no] >>> yes (是否初始化)
      no change     /usr/envs/anaconda3/condabin/conda
      no change     /usr/envs/anaconda3/bin/conda
      no change     /usr/envs/anaconda3/bin/conda-env
      no change     /usr/envs/anaconda3/bin/activate
      no change     /usr/envs/anaconda3/bin/deactivate
      no change     /usr/envs/anaconda3/etc/profile.d/conda.sh
      no change     /usr/envs/anaconda3/etc/fish/conf.d/conda.fish
      no change     /usr/envs/anaconda3/shell/condabin/Conda.psm1
      no change     /usr/envs/anaconda3/shell/condabin/conda-hook.ps1
      no change     /usr/envs/anaconda3/lib/python3.8/site-packages/xontrib/conda.xsh
      no change     /usr/envs/anaconda3/etc/profile.d/conda.csh
      modified      /home/noname/.bashrc
      
      ==> For changes to take effect, close and re-open your current shell. <==
      
      If you'd prefer that conda's base environment not be activated on startup, 
      set the auto_activate_base parameter to false: 
      
      conda config --set auto_activate_base false
      
      Thank you for installing Anaconda3!
      
      ===========================================================================
      
      Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
      designed to be used with Anaconda. Download now and have the best data
      tools at your fingertips.
      
      PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm
      
      
  • 配置

    • 初始化[1] Anaconda(安裝時初始化了則跳過)

      # 如果如果anaconda安裝初始化時,選擇的no,那現在應該還用不了conda命令
      # 執行 source $ANACONDA_HOME/bin/activate, 如:
      source /usr/envs/anaconda3/bin/activate
      # 初始化
      conda init
      
    • 關閉啟動時激活Conda基礎環境(可選)

      # 如果您不希望在啟動時激活Conda基礎環境,將AUTO_ACTIVATE_BASE參數設置為FALSE:
      conda config --set auto_activate_base false
      
    • Anaconda 鏡像配置
      點擊前往Anaconda 鏡像配置

卸載

  • 刪除Anaconda 文件夾

    # rm -rf $ANACONDA_HOME,如:
    rm -rf /usr/envs/anaconda3
    
  • 刪除Anaconda 配置

    # 打開配置文件
      vim ~/.bashrc
    
    # 刪除下面這段配置
    
    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$('/usr/envs/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__conda_setup"
    else
        if [ -f "/usr/envs/anaconda3/etc/profile.d/conda.sh" ]; then
            . "/usr/envs/anaconda3/etc/profile.d/conda.sh"
        else
            export PATH="/usr/envs/anaconda3/bin:$PATH"
        fi
    fi
    unset __conda_setup
    # <<< conda initialize <<<
    
  • 更新配置文件

    source ~/.bashrc
    或者 source /etc/profile
    



Reference


  1. Linux安裝anaconda3是否初始化的區別 ↩︎


免責聲明!

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



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