虚拟环境装torch与cuda

遇到问题1

在python环境中导入torchvision的时候,出现了以下错误
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'
问题:Pillow包版本过高。
解决方法:1.卸载新版本 pip uninstall Pillow
2.安装新版本 pip install Pillow==6.2.2
备注:通过conda进行uninstall好像会把torchvision一起卸掉

遇到问题2

报错Torch not compiled with CUDA enabled
nvcc -V是有输出的
问题:Torch找不到cuda,版本不太对
解决方法:1.卸载 pip uninstall torch torchvision torchaudio
2. cuda版本11.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
正确截图:

错误截图:

posted @ 2024-03-28 21:58  心比天高xzh  阅读(73)  评论(0)    收藏  举报