1.创建环境
conda create --name pytorch python=3.6#pytorch 是环境名,可以根据自己需求更改
2.查看当前所有虚拟环境
conda info --e#或者是-envs
3.激活所需环境
activate pytorch#Windows 环境名
source activate pytorch #ubuntu
4.添加镜像
conda config --add channels +镜像地址
conda config --set show_channel_urls yes
清华大学:
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/cloud/conda-forge/
ssl_verify: true
中科大镜像:
channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
上海交大镜像:
channels:
- https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/
- https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/
- https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
还原镜像:
conda config --remove-key channels
删除某一镜像:
conda config --remove channels +镜像地址
查看目前已有镜像:
conda config --show
5.在jupyter notebook添加新核
(1)先配置环境比如:pytorch 或者TensorFlow
(2)安装nb_conda_kernels
包
conda install nb_conda_kernels
(3)激活进入配置好的环境
source activate 环境名 #Ubuntu环境下
(4)安装ipykernel
pip install ipykernel
(5)添加新核
python -m ipykernel install --name (pytorch)#环境名
查看当前的核情况:
jupyter kernelspec list
删除某一个核:
使用命令jupyter kernelspec remove (kernelname)