import torchvision出错

import torchvision出错,第1张

Traceback (most recent call last):
  File "", line 1, in
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/__init__.py", line 7, in
    from torchvision import datasets
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/datasets/__init__.py", line 9, in
    from .fakedata import FakeData
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/datasets/fakedata.py", line 4, in
    from .. import transforms
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/transforms/__init__.py", line 1, in
    from .transforms import *
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/transforms/transforms.py", line 16, in
    from . import functional as F
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/transforms/functional.py", line 18, in
    from . import functional_pil as F_pil
  File "/home/nvidia/.local/lib/python3.6/site-packages/torchvision-0.9.0-py3.6-linux-aarch64.egg/torchvision/transforms/functional_pil.py", line 207, in
    def resize(img, size, interpolation=Image.BILINEAR):
AttributeError: module 'PIL.Image' has no attribute 'BILINEAR

解决:受到这篇文章启发pytorch使用踩坑import torchvision

将我原本的pillow9.1.0卸载,安装pillow8(pip3 install pillow==8)即可。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/794273.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-06
下一篇 2022-05-06

发表评论

登录后才能评论

评论列表(0条)

保存