xxxxxxxxxx
The best way is going to pytorch official website and coping the code
presented since it gives the best version according to your systems
requirements
xxxxxxxxxx
#for cuba
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116