1. Enter the official website of pytorch
pytorch official website: https://pytorch.org/
2. Select the environment on the page
3. Copy the command that pops up on the official website and run it
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118