# first_pytorch **Repository Path**: weitinting/first_pytorch ## Basic Information - **Project Name**: first_pytorch - **Description**: first_pytorch - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-20 - **Last Updated**: 2025-10-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Windows环境下Pytorch环境搭建 创建python虚拟环境 conda create -n python311 python=3.11 激活python虚拟环境python311 conda activate python311 2.添加清华镜像网站到Anaconda: conda config --add channels http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes 安装 jupyter notebook pip install jupyter notebook 启动jupyter notebook Jupyter Notebook 修改工作空间: c.NotebookApp.notebook_dir = 'D:\workspace\jupyter' 常用命令: conda env list conda create --prefix D:\tools\Anaconda3\envs\python313 python=3.13.5 CondaError: Unable to create prefix directory 'D:\tools\Anaconda3\envs\python313'. Check that you have sufficient permissions. 方案一:以管理员身份运行(临时解决) conda create --prefix D:\tools\Anaconda3\envs\python313 python=3.13.5 conda remove -n python313 --all conda env list python313 D:\tools\Anaconda3\envs\python313 方案二:更改 Conda 虚拟环境的默认存储位置 # 编辑 C:\Users\你的用户名\.condarc 增加下面的配置 envs_dirs: - D:\tools\Anaconda3\envs .condarc个人电脑配置如下: channels: - http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - defaults show_channel_urls: true envs_dirs: - D:\tools\Anaconda3\envs C:\Users\admin>conda config --show envs_dirs envs_dirs: - D:\tools\Anaconda3\envs - C:\Users\admin.conda\envs - D:\tools\Anaconda\envs - C:\Users\admin\AppData\Local\conda\conda\envs 创建pytorch虚拟环境 (base) C:\Users\admin>conda create --prefix D:\tools\Anaconda3\envs\pytorch python=3.13.5 (base) C:\Windows\system32>conda env list # conda environments: # base * D:\tools\Anaconda D:\tools\Anaconda3 python311 D:\tools\Anaconda3\envs\python311 python313 D:\tools\Anaconda3\envs\python313 pytorch D:\tools\Anaconda3\envs\pytorch (base) C:\Windows\system32>conda activate D:\tools\Anaconda3\envs\pytorch 不要直接使用pip install pytorch,这是源码安装,需要复杂的依赖,直接使用预编译的二进制包(wheel)就可以 (pytorch) PS C:\Users\admin> pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu