直接在anaconda prompt创建虚拟环境,不用打开anaconda navigator创建
(谁能告诉我为什么我的要离线才能打开,尊的很烦)
1.cuda不用单独下载,驱动里有就可以了
2.cuda向下兼容
3.改源:(C:Users(root用户).condarc)
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/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
show_channel_urls: true
ssl_verify: false
4.创建虚拟环境pytorch
python=3.7是确定当前环境的版本
在虚拟环境下操作:
下载时去掉-c pytorch才能在改的源下载
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3
pip install opencv-python==4.4.0.44 pillow==8.2 numpy==1.21 matplotlib scipy pandas scikit-learn tqdm scikit-image imutils PyYAML imageio==2.9.0 tensorboard seaborn protobuf==3.20 -i https://pypi.douban.com/simple/
pip list:查看当前环境下有哪些包
5.导入pycharm
pycharm中导入pytorch_Handsome coder的博客-CSDN博客_pycharm导入pytorch
测试代码:
import torch import torchvision print(torch.__version__) print(torchvision.__version__) print(torch.cuda.is_available()) print(torch.cuda.get_device_properties(0))
(中间好像遗漏了几个地方,再补充吧)



