Pytorch 安装环境配置 (old)

建立环境

  1. 建立一个新环境 name = pytorch

    conda create -n pytorch python

  2. 进入 pytorch 工作环境 conda activate pytorch

  3. 查看安装包 pip list

  4. 查询显卡型号:

    任务管理器中,查看 Geforce GTX 950M https://developer.nvidia.com/cuda-gpus

    查看驱动版本: C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi.exe

    Driver Version: 388.57 ==>需要升级驱动 https://developer.nvidia.com/drive/downloads

查看驱动版本:check graphic card and driver both suppot the CUDA varsion

cd C:\Program Files\NVIDIA Corporation\NVSMIconda //windows

nvidia-smi.exe

   NVIDIA-SMI version: 512.15
   Card type: NVIDIA GeForce 
   CUDA Version: 11.6

Check Compute Capabilities:

https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html

### CUDA Toolkit version need match Card Driver Version 
	
	CUDA 12.0.x     >=527.41 (Windows Driver)
	CUDA 11.6.x     >=452.39 (Windows Driver)

| NVIDIA-SMI 512.15 Driver Version: 512.15 === CUDA Version: 11.6 |

安装CUDA Toolkit and NVIDIA Driver

NVIDIA Driver Downloads: https://www.nvidia.com/download/index.aspx

CUDA Toolkit Downloads: https://developer.nvidia.com/cuda-downloads

安装 pytorch

  1. 选择系统,软件包,下载版本,产生下载安装命令 https://pytorch.org/get-started/locally/

Anaconda Prompt (anaconda3)

Why pip install does not working?

查询是否有torch

The solution of GPU is not available (if torch.version.cuda return none)

Run Jupyter lab with GPU

Method 1: Run Anaconda Navigator, Launch JupyterLab

Method 2: Run Anaconda Prompt (Anaconda3) -- entry command, then run jupyterlab.bat jupyterlab.bat: D:\ProgramData\Anaconda3\python.exe d:\ProgramData\Anaconda3\cwp.py d:\ProgramData\Anaconda3 d:\ProgramData\Anaconda3\python.exe d:\ProgramData\Anaconda3\Scripts\jupyter-lab-script.py "%USERPROFILE%/"

Install pytorch genmetric https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html

## check torch version //v1.11

print(torch.version) // in jupyter python -c "import torch; print(torch.version)"

##To move tensors to the respective device: torch.rand(10).to(device)

##To create a tensor directly on the device: torch.rand(10, device=device)

安装其他包

Last updated

Was this helpful?