官方网站
https://pytorch.org/get-started/locally/
START LOCALLY
Select your preferences and run the install command. Stable represents the most currently tested and supported version of PyTorch. This should be suitable for many users. Preview is available if you want the latest, not fully tested and supported, builds that are generated nightly. Please ensure that you have met the prerequisites below (e.g., numpy), depending on your package manager. Anaconda is our recommended package manager since it installs all dependencies. You can also install previous versions of PyTorch. Note that LibTorch is only available for C++.
NOTE: Latest PyTorch requires Python 3.8 or later. For more details, see Python section below.
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia