安装 conda & R 4.0.3 & Python 3.6


快速配置 R 4.0.3 环境,请参考:1.1, 1.2 和 2.
快速配置 Python 3.6 环境,请参考:1.1, 1.2 和 3.

1. 安装 conda

1.1 安装

# 下载
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda2-latest-Linux-x86_64.sh

如果集群上已经安装过python,安装miniconda2(conda+python2)时可能会遇到以下报错信息:

sh Miniconda2-latest-Linux-x86_64.sh
:'
... ...
WARNING:
    You currently have a PYTHONPATH environment variable set. This may cause
    unexpected behavior when running the Python interpreter in Miniconda2.
    For best results, please verify that your PYTHONPATH only points to
    directories of packages that are compatible with the Python interpreter
    in Miniconda2: /path/miniconda2
Do you wish the installer to initialize Miniconda2
by running conda init? [yes|no]
[no] >>> yes
Traceback (most recent call last):
  File "/path/miniconda2/bin/conda", line 12, in <module>
    from conda.cli import main
ImportError: No module named conda.cli
... ...
'

解决方法如下:

# 防止环境变量冲突
unset PYTHONPATH
unset PYTHONHOME
# 安装
sh Miniconda2-latest-Linux-x86_64.sh

1.2 配置和升级

# 添加channel以提高下载速度
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
# 升级
conda upgrade --all

#其它用法(可选)
conda config --show channels #查看源
conda config --add channels <channels> #添加源
conda config --remove channels <channels> #移除源
conda config --set show_channel_urls yes #安装包时显示channel url
#此外还可以通过修改.condarc文件查看、添加或移除源

1.3 包管理

conda list                      #查看已安装包
conda  search search_term      #搜索包信息
conda install <package_name>  #安装包
conda remove <package_name>  #卸载包
conda update <package_name> #更新包

1.4 环境管理

conda env list #查看已有环境
conda create -n <env_name> (<packages>) #创建环境
source activate <env_name>              #激活环境
source deactivate                       #退出环境
conda env remove -n <env_name> #删除环境
conda env export > env.yaml
conda env create -f env.yaml

2. 安装R 4.0.3

conda create -n r4
source activate r4
conda install r-base=4.0.3
source deactivate

3. 安装Python 3.6

conda create -n py3 python=3.6
conda activate py3
  • 7
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值