PyTorch is a popular open-source machine learning library used for applications such as computer vision and natural language processing. To get started, follow these installation steps:
1. Choose Your Environment
- Python (Recommended): Use Python's official documentation to set up your environment.
- Conda (For Anaconda users): Use Conda's installation guide to manage dependencies.
2. Install via pip
Run the following command in your terminal:
pip install torch torchvision torchaudio
📌 Tip: Use pip install torch==1.10.0+cu113 torchvision==0.11.0+cu113 torchaudio==0.11.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
for specific versions.
3. Install via Conda
Execute:
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
🔧 Note: Ensure your Conda environment is activated before installation.
4. Verify Installation
Run this Python code to check:
import torch
print(torch.__version__)
print(torch.cuda.is_available())
✅ Expected output: A version number and True
(if CUDA is available).
5. Additional Resources
- PyTorch Installation Guide for more options.
- PyTorch Tutorials to explore features after installation.