1 创建环境名字
指定python版本
conda create --name tensorflow python=3.6.6
2 激活环境
conda activate tensorflow
3 安装tensorflow的gpu版本
指定版本号
conda install tensorflow-gpu=1.12.0
4 代码中要用到import torch,安装pytorch
查看版本
指定版本号
conda install pytorch torchvision cudatoolkit=9.2 -c pytorch
报错:AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'
退出已安装的环境,到base下查看版本
nvcc -V
安装正确版本
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
5 No module named 'matplotlib'
pip install matplotlib