ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

pytorch环境配置

2026/9/14 21:03:57 拓冰建站 浏览量
pytorch环境配置

1.创建环境
conda create --name pytorch python=3.11.5 
2.激活环境
source activate pytorch 
3.添加国内镜像源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
4.配置pytorch CPU版本
CPU版本:

pip install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple

GPU版本:cuda11.8版本

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 -i https://pypi.tuna.tsinghua.edu.cn/simple