配置yolov5时遇到的一些问题和解决方案

本人用的是cuda11.3,未用conda,时间2022.4.3

1.不要直接在cmd里输入pip install pytorch,这样安装的pytorch是cpu版本

可以pip uninstall pytorch卸载了

应该用配置yolov5时遇到的一些问题和解决方案_第1张图片

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

2.如果有python的虚拟环境,需要在该虚拟环境下文件夹下打开cmd再安装

3.在pycharm的terminal中安装pytorch和pytorchvision遇到UnicodeDecodeError: 'gbk' codec can't decode byte 0x98 in position 1027: illegal multibyte sequence

需要在Windows里的cmd安装(配合2)

4.运行detect.py遇到NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during t
he selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'to
rchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradLazy, AutogradXPU, AutogradMLC, AutogradHPU, Tracer, AutocastCPU, Autocast, Batched, VmapMode, Functionalize].

卸载pytorch:pip uninstall pytorch(配合2)

重新安装

pytorchvision0.12.0+cu113(配合1、2)

pip install torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html

配置yolov5时遇到的一些问题和解决方案_第2张图片

 

你可能感兴趣的:(python,pytorch)