Python permanently modifies pip mirror source
If change the mirror source to Tsinghua Mirror Source, type the following code in the Terminal:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Install Cuda In Virtual Environment of Conda
First Run the code in the Terminal to determine the version of Cuda:
nvidia-smi
CUDA Version
is the version of cuda that the computer can support, so the version of cuda we want to install needs to be <= CUDA Version
(backward compatible)
Run the code in order in the Terminal:
conda create -n env_name python=3.10
conda activate env_name
# conda search cudatoolkit --info
conda install cudatoolkit=11.8.0
conda install cudnn
# pytorch official website: https://pytorch.org/get-started/locally/
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
After installing the Cuda
, Run the code in order in the Terminal and verify that Cuda
was installed successfully:
conda activate env_name
python
import torch
print(torch.cuda.is_available())