[Python]Anaconda相关命令

环境操作相关命令

查看所有环境

conda env list

创建环境

conda create --name cahttts python=3.10

激活环境

conda activate cahttts

安装依赖文件

pip install -r requirements.txt

查看GPU型号

 nvidia-smi -L
GPU 0: NVIDIA A10 (UUID: GPU-9f1fc9cf-582a-25ac-849c-2f77343f9a37)

删除虚拟环境

conda remove -n you_name --all

验证cuda环境

import torch

if_cuda = torch.cuda.is_available()
print("if_cuda=", if_cuda)
gpu_count = torch.cuda.device_count()
print("gpu_count=", gpu_count)

无cuda环境
image.png
已安装conda环境
image.png
安装环境(依照自己的N卡coda版本来选择,ps:不要问,A卡应该怎么安装)
按照官网来选择安装
https://pytorch.org/
image.png
例如我现在的是Windows环境下的Conda安装,选择执行如下命令

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

查看torch版本

import torch
print(torch.__version__)  #注意是双下划线

得到以下输出

2.1.2+cu118

修改conda环境的名称

修改conda环境名称(找到指定目录,直接修改文件夹即可)
image.png
image.png
conda相关命令

NVIDIA CUDA各版本下载链接

所有版本下载

https://developer.nvidia.com/cuda-toolkit-archive
image.png

11.8 cuda

https://developer.nvidia.com/cuda-11-8-0-download-archive
image.png

  • 9
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

落杉丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值