I would say use anaconda enovirement and install torch using conda .
Look out for command like
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
you can see the command in https://pytorch.org/ 2
conda command will install all CUDA libraries required.
Now if you still don’t want to use anaconda then you have to check for PyTorch version compatibility with installed system CUDA.
I can see your command is compatible with CUDA 10.2
but you have CUDA 11.2 installed.
i don’t know compatible PyTorch version of CUDA 11.2
I would suggest use anaconda, it will save lot of time.