Install PyTorch
Visit pytorch.org/get-started/locally and select your preferences (OS: Linux/macOS/Windows, Package: Pip, etc.). For CPU-only stable (2.10+):
# Linux / macOS
pip3 install torch torchvision torchaudio
# Windows
pip install torch torchvision torchaudio
Verify installation:
import torch
print(torch.__version__)
x = torch.rand(5, 3)
print(x)
Use Google Colab for GPU (no install needed) or set up Jupyter: pip install jupyter then jupyter notebook.
Pro Tip: Use virtual env: python -m venv pytorch_env, activate, then install.