conda 高频应用命令
https://docs.conda.io/en/latest/miniconda.html #conda 安装
rm -rf /mypath/minconda ~/.condarc ~/.conda ~/.continuum #conda 卸载
#conda 环境创建 软件安装
conda create -n 'U_env' python=2 -y #创建python2的环境
conda activate 'U_env'
conda search 'pack(r-pack)'
conda intall -c channel 'pack=version' #从指定channel 安装指定版本的软件
conda remove -n 'U_env' --all
写出conda 环境ymal配置文件
conda env export --file U_env.yml --name U_env #导出环境配置
conda env create -f U_env.yml #新设备部署环境
常用conda channel 配置
新装conda执行conda config
在用户目录生成.condarc 配置文件
channels:
- conda-forge
- bioconda
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
超级管理员 root 配置 conda 环境给普通用户使用
下载: root 用户下载minconda wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
安装 bash Miniconda3-latest-Linux-x86_64.sh
根据提示完成安装
配置channel conda config
生成在/root目录.condarc
》》》建议重启主机《《《
切换普通用户使用conda 命令: /__path__/conda init bash
激活使用
普通用户创建的环境conda create -n xxx python=3.9.0
将放置在用户的home目录下
显示所有环境路径 conda env list
配置 jupyter-notebook
安装 conda install jupyter
生成配置文件: jupyter-notebook --generate-config
编辑配置文件,建议修改如下内容
#将ip设置为*,意味允许任何IP访问
c.NotebookApp.ip = ' * '
# 服务器上并没有浏览器可以供Jupyter打开
c.NotebookApp.open_browser = False
# 监听端口设置为8888或其他自己喜欢的端口
c.NotebookApp.port = 8898 ### 注意服务器的 firewall 需要放行 8898 端口
# 我们可以修改jupyter的工作目录,也可以保持原样不变,如果修改的话,要保证这一目录已存在
c.MappingKernelManager.root_dir = '/root/jupyter_codes'
# 允许远程访问
c.NotebookApp.allow_remote_access = True
# 添加登入密码
c.NotebookApp.password = u'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
后台挂起来 jupyter notebook nohup jupyter notebook --allow-root &>~/jupyter.log &
配置 jupyterhub 进行多用户管理
安装:conda install -c conda-forge jupyterhub=2.0.0 -y
在当前目录创建配置文件 jupyterhub --generate-config
使用指定的配置文件启动jupyterhub jupyterhub -f /__path__/jupyterhub_config.py