anaconda配置那些事

本文详细介绍了如何使用Anaconda进行Python环境的创建、管理及Jupyter Notebook核的配置,包括环境创建、镜像源设置、核添加与管理等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值