2023.11.11总结_pytorch环境配置

Pytorch安装

PyTorch

pip安装

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

使用使用pip安装pytorch不会安装cudatoolkit(不知道会不会产生问题)

conda安装

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch

报错(待解决)

使用conda安装pytorch时在import torchvision时会报错:

ImportError: DLL load failed while importing _imaging: 找不到指定的模块

为jupyter添加kernel

#安装ipykernel
conda install ipykernel 
#添加kernel
python -m ipykernel install --name conda_env_name
 
python -m ipykernel install --user --name conda_env_name -- kernel_name
#查看所有kernel
jupyter kernelspec list
#删除特定的kernel
jupyter kernelspec uninstall your_kernel_name