問題背景
運行yolov5時出現下面的warning,雖然不影響運行,但是看著很難受。在python環境下import torchvision也是下面的問題,說明就是無法加載torchvision庫。
/home/firefly/anaconda3/envs/yolo/lib/python3.8/site-packages/torchvision/io/image.py:13:
UserWarning: Failed to load image Python extension: warn(f"Failed to load image Python extension: {e}")
問題原因
pytorch和torchvision的版本沒對應上,下圖是pytorch和torchvision的正確對應版本,請根據自己情況,重裝pytorch或者重裝torchvision。

問題解決
1、進入我們的anaconda環境,pip list顯示我們的所有庫。可以看到我這裡的torch是1.11.0,根據上表得知對應的torchvision應該是0.10.0,而我安裝的是0.12.0,所以報錯。

2、pip3 uninstall torchvision卸載torchvision。

3、pip3 install torchvision==0.10.0指定安裝torchvision的版本。

我們再次import torchvision,沒有任何報錯,成功導入,問題解決!

Only the first one works normally. Once you add the part circled in the second one to the first one, python will flash back. Whats the matter? How to solve it?
Only the first one can run nor
How does pandas change from one line to another (splicing and aggregating text)?
1. Scenario introduction Some