【Python】UserWarning: Argument interpolation should be of type InterpolationMode instead of int 解决方案

运行项目遇到如下警告:

 UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum. warnings.warn( 

这其实是torchvision和pillow不兼容导致的。

降低torchvision版本,但是torchvision的版本号一般都是和pytorch绑定好的,我们需要不依赖torch来更改torchvison的版本,这可以通过以下指令实现:

pip3 install --no-deps torchvision==0.8.2

再将pillow降到6.2.2即可。

pip install pillow==6.2.2

温馨提示:
不管你的电脑上的这两个包的版本是多少,都根据上述方法,将版本改掉,即可消除警告。

猜你喜欢

转载自blog.csdn.net/lingchen1906/article/details/129392091