1.安裝
第一步:在 Anaconda官網 選擇下載對應系統 Python3.7版本下載(Mac下載Command Line Installer版本即可)。
復制鏈接wget就行
第二步:安裝,執行 bash Anaconda3-2021.05-Linux-x86_64.sh
安裝過程中一直回車即可,如提示設置安裝路徑,可根據需求修改,一般默認即可。
第三步:驗證安裝是否成功 anaconda -h
發現一個有趣的提示:
通常安裝anaconda后,打開終端會默認進入base環境,其實可設置:
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
2.使用
# 創建名為my_paddlenlp的環境,指定Python版本為3.7 conda create -n my_paddlenlp python=3.7 # 進入my_paddlenlp環境 conda activate my_paddlenlp # 安裝PaddleNLP pip install --upgrade paddlenlp==2.1.0 -i https://pypi.org/simple # 也可以用conda install安裝 conda install -c huggingface transformers # 退出虛擬環境 conda deactivate # 查看本機所有的anaconda虛擬環境 conda env list # 查看當前環境所有的python包 conda list # # 刪除虛擬環境 conda remove -n your_env_name(虛擬環境名稱) --all
3. conda換源
換成清華鏡,參考 https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
首先在用戶根目錄下,新建 .condarc
channels: - defaults show_channel_urls: true default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels: conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud ssl_verify: false
然后就會發現快樂很多
參考鏈接:
1. https://github.com/PaddlePaddle/PaddleNLP/blob/develop/docs/get_started/installation.rst
2. https://zhuanlan.zhihu.com/p/168748757