Anaconda常用命令
- 创建pyhon=3.6的版本环境取名叫 nlp
conda create -n nlp python=3.6
- 删除虚拟环境操作:(谨慎操作)
conda remove -n nlp --all
- 激活环境
conda activate nlp
- 查看环境下已有的安装包:
conda list
conda-env list - 在进入虚拟环境的情况下,安装对应包直接
pip install xxxx 或者 conda install xxxx
- 退出当前虚拟环境:
conda deactivate
- 重命名环境
conda create -n tf2 --clone nlp
*>>> import torch
查看torch版本
torch.version
'1.2.0'
import torchvision
查看torchvision版本
torchvision.version
'0.4.0'
查看gpu是否可用
torch.cuda.is_available()
True
查看gpu是个数
torch.cuda.device_count()
1
查看当前gpu
torch.cuda.current_device()
0
查看gpu设备名称
torch.cuda.get_device_name(0)
'GeForce GTX 1650'
