Anaconda(或
Miniconda)按官网文档下载安装1。
Windows 推荐使用 Miniconda
安装文件,默认设置Python 环境打开命令行终端 Anaconda Prompt,并输入以下代码:
conda activate aiconda create --name ai
conda activate ai# CPU, Linux
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
# CPU, Windows/Mac
pip3 install torch torchvisionpython -c "import torch; print(f\"CUDA available? {torch.cuda.is_available()}\"); print(torch.rand(5, 3));"Usually a false alarm: restart the terminal. If the error persists:
try lower python versions
conda create --name ai python=3.9, or write to the official
maintainers.
See: Quickstart @ pytorch.org3.