其他分享
首页 > 其他分享> > paddlepaddle 报错:DeprecationWarning: Using or importing the ABCs from ‘collections‘ instead of from ‘

paddlepaddle 报错:DeprecationWarning: Using or importing the ABCs from ‘collections‘ instead of from ‘

作者:互联网

在使用paddlepaddle时,需要导入paddle

import paddle

然后立马报错:

beimingke@beimingke:~/padtest$ python3 tensor.py
/home/beimingke/anaconda3/lib/python3.7/site-packages/socks.py:58: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

这种 warning 就是快过期的不向后兼容的语法做了个警告,可以不用理会,如果你是强迫症,看着实在不爽,可以修改一下anaconda3库中的内容。由于使用的事Python,修改非常简单,改完源码不用编译。
网上也提供了一些方法,可能很多人未必能找到源码对应的位置,这里为了尽可能小的不影响Python库本身的影响,直接找到
…/anaconda3/lib/python3.7/site-packages/socks.py
将里面的

from collections import Callable

改为

from collections.abc import Callable

问题直接解决。

标签:DeprecationWarning,anaconda3,py,collections,beimingke,报错,import,instead
来源: https://blog.csdn.net/qq_41736617/article/details/113831927