xingchenshanyao / NNLearning

这里只是学习深度学习过程中的一些记录
4 stars 0 forks source link

ubuntu18.04-cuda11.8-anaconda3配置torch模型环境 #27

Open xingchenshanyao opened 1 year ago

xingchenshanyao commented 1 year ago
  1. 选择torch 在以下网站中选择合适的torch和torchvision版本
    http://download.pytorch.org/whl/torch_stable.html

    根据cuda11.8版本,python采用3.8版本,linux系统,选择下载以下torch和torchvision版本安装包

    文件名:cu118/torch-2.0.0%2Bcu118-cp38-cp38-linux_x86_64.whl
    http://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp38-cp38-linux_x86_64.whl
    文件名:cu118/torchvision-0.15.0%2Bcu118-cp38-cp38-linux_x86_64.whl
    http://download.pytorch.org/whl/cu118/torchvision-0.15.0%2Bcu118-cp38-cp38-linux_x86_64.whl
xingchenshanyao commented 1 year ago

2.创建虚拟环境 新建终端,输入

conda create -n [your-name] python=3.8
xingchenshanyao commented 1 year ago

3.安装torch 在下载文件夹中新建终端,激活虚拟环境,输入

conda activate [your-name]

安装torch

pip install torch-2.0.0+cu118-cp38-cp38-linux_x86_64.whl

安装torchvision

pip install torchvision-0.15.0+cu118-cp38-cp38-linux_x86_64.whl
xingchenshanyao commented 1 year ago

下面是一些附加内容,可以先不管(对师弟师妹们说的) 4.安装一系列module 建议先换清华源以及开VPN

pip install matplotlib
pip install scipy
pip install opencv-python
pip install tqdm
pip install tensorboard
pip install pillow
pip install h5py

默认安装最新版,罗列一下此时各module的版本

matplotlib==3.7.1
scipy==1.10.1
opencv-python==4.7.0.72
tqdm==4.65.0
tensorboard==2.12.2
pillow==9.5.0
h5py==3.8.0
xingchenshanyao commented 1 year ago
  1. bug -1.安装torch时,默认安装最新版的numpy==1.23.3,运行deeplabv3+模型train.py时提示版本过高,需要降低numpy版本
    pip uninstall numpy
    pip install numpy==1.20.0
xingchenshanyao commented 1 year ago

6.最简单的方法: 从相同配置的电脑里拷贝粘贴即可: 1