关于conda的指令

查看conda环境

conda-env list

删除conda环境

conda remove -n 环境名 --all

创建环境、激活环境con

conda create -n 环境名 python=3.8
conda activate 环境名

退出conda

conda deactivate

查看cuda版本

nvcc --version

在这里插入图片描述
添加清华源

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/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes# 设置搜索时显示通道地址

中科大源

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --set show_channel_urls yes# 设置搜索时显示通道地址

恢复默认源:

conda config --remove-key channels

pip install 时使用豆瓣源
pip install 包名称 -i https://pypi.douban.com/simple/
pip install -r req.txt -i https://pypi.douban.com/simple/

-i https://pypi.douban.com/simple/

查看pytorch是否安装成功

import torch
print(torch.__version__)	#Torch版本
print(torch.cuda.is_available())	#torch是否cuda可用
print(torch.cuda.device_count())	#有几个gpu
print(torch.cuda.get_device_name(0))	# gpu名称
print(torch.cuda.current_device())	#当前在几号卡

# 1.9.0
# True
# 2
# NVIDIA GeForce RTX 3090
# 0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值