一、软件预准备
1. 软件下载
https://repo.anaconda.com/archive/index.html
或者,我们可以复制下载的链接,直接在服务器上下载,如:
wget -c https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
2. 安装conda
在conda文件的统计目录下输入命令安装,一路回车,直到他要求输入yes
bash Anaconda3-2021.05-Linux-x86_64.sh
3. 设置环境变量
配置环境变量,这里的export PATH填的是conda的bin文件地址,我是安装在家目录的所以是这样,前面一个命令是添加环境变量,后者是刷新bashrc
vim /etc/profile
在末尾添加环境变量
export PATH=~/anaconda3/bin:$PATH
vim ~/.bashrc
export PATH=~/anaconda3/bin:$PATH
刷新环境变量
source /etc/profile
source ~/.bashrc
然后conda -V要是正常就安装成功了
注:三种配置环境变量的方法
修改/etc/profile
修改.bashrc
直接在shell下用export命令修改
二、镜像源配置
2.1. conda配置
vim ~/.condarc
然后配置镜像,如文章来源:https://www.toymoban.com/news/detail-598669.html
channels:
- http://mirrors.aliyun.com/anaconda/cloud/stackless
- https://mirrors.aliyun.com/anaconda/cloud/simpleitk
- https://mirrors.aliyun.com/anaconda/cloud/rdkit
- https://mirrors.aliyun.com/anaconda/cloud/rapidsai
- https://mirrors.aliyun.com/anaconda/cloud/qiime2
- https://mirrors.aliyun.com/anaconda/cloud/pyviz
- https://mirrors.aliyun.com/anaconda/cloud/pytorch3d
- https://mirrors.aliyun.com/anaconda/cloud/pytorch-test
- https://mirrors.aliyun.com/anaconda/cloud/pytorch
- https://mirrors.aliyun.com/anaconda/cloud/psi4
- https://mirrors.aliyun.com/anaconda/cloud/plotly
- https://mirrors.aliyun.com/anaconda/cloud/omnia
- https://mirrors.aliyun.com/anaconda/cloud/ohmeta
- https://mirrors.aliyun.com/anaconda/cloud/numba
- https://mirrors.aliyun.com/anaconda/cloud/msys2
- https://mirrors.aliyun.com/anaconda/cloud/mordred-descriptor
- https://mirrors.aliyun.com/anaconda/cloud/menpo
- https://mirrors.aliyun.com/anaconda/cloud/matsci
- https://mirrors.aliyun.com/anaconda/cloud/intel
- https://mirrors.aliyun.com/anaconda/cloud/idaholab
- https://mirrors.aliyun.com/anaconda/cloud/fermi
- https://mirrors.aliyun.com/anaconda/cloud/fastai
- https://mirrors.aliyun.com/anaconda/cloud/dglteam
- https://mirrors.aliyun.com/anaconda/cloud/deepmodeling
- https://mirrors.aliyun.com/anaconda/cloud/conda-forge
- https://mirrors.aliyun.com/anaconda/cloud/caffe2
- https://mirrors.aliyun.com/anaconda/cloud/c4aarch64
- https://mirrors.aliyun.com/anaconda/cloud/bioconda
- https://mirrors.aliyun.com/anaconda/cloud/biobakery
- https://mirrors.aliyun.com/anaconda/cloud/auto
- https://mirrors.aliyun.com/anaconda/cloud/Paddle
- https://mirrors.aliyun.com/anaconda/pkgs/r
- https://mirrors.aliyun.com/anaconda/pkgs/msys2
- https://mirrors.aliyun.com/anaconda/pkgs/main
- https://mirrors.aliyun.com/anaconda/pkgs/free
show_channel_urls: true
ssl_verify: true
allow_conda_downgrades: true
2.2. pip配置
mkdir ~/.pip
cd ~/.pip/
vim pip.conf
然后配置镜像,如:文章来源地址https://www.toymoban.com/news/detail-598669.html
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
2.3. chatglm-6b专用
# 创建虚拟环境
conda create -n ChatGLM python==3.10
conda init bash
# 换一个窗口执行
conda activate ChatGLM
2.3. 常用命令
# 创建虚拟环境
conda create -n name python==3.7
# 激活环境
conda activate name
# 退出环境
conda deactivate
# 查看虚拟环境
conda info --envs
# 删除虚拟环境
conda remove -n name --all
# 删除所有的安装包及cache(索引缓存、锁定文件、未使用过的包和tar包)
conda clean -y --all
# 删除pip的缓存
rm -rf ~/.cache/pip
到了这里,关于linux conda环境安装的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!