miniconda安装
借助miniconda安装python,便于多种Python环境的管理。
1)下载最新版本的minconda
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
注意:若提示wget命令不存在,执行 yum install wget -y 安装即可
2)安装miniconda
[root@song envs]# ll
total 65148
-rw-r--r--. 1 root root 66709754 Jul 22 00:13 Miniconda3-latest-Linux-x86_64.sh
[root@song envs]# chmod 777 Miniconda3-latest-Linux-x86_64.sh #给执行权限
[root@song envs]# bash Miniconda3-latest-Linux-x86_64.sh #运行
···
Please answer 'yes' or 'no':'
>>> yes
Miniconda3 will now be installed into this location:
/root/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/miniconda3] >>> /root/envs/miniconda3 #选择yes默认安装位置;或者直接自定义路径
3)测试安装是否成功
(base) [root@song bin]# conda -V
conda 4.10.3
显示版本号,则安装成功。
若显示conda命令找不到,则环境变量配置有问题或者未生效
[root@song envs]# conda -V
bash: conda: command not found...
解决方法:
[root@song bin]# vim ~/.bashrc #查看是否配置环境变量
#在最后一行加上,取决于每个人的实际安装路径
export PATH=$PATH:/root/envs/miniconda3/bin
[root@song bin]# source ~/.bashrc #运行生效
(base) [root@song bin]# conda -V
conda 4.10.3
拓展:配置镜像源
(base) [root@song bin]#cp ~/.condarc ~/.condarc.bak #以防出错,先备份
(base) [root@song bin]# cd ~
(base) [root@song ~]# vim .condarc
#将内容全部删除,修改为下面的配置
(base) [root@song ~]# conda clean -i #清除缓存
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- 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