【踩坑】PGL报错cannot import name ‘paddle_helper‘ from ‘pgl.utils‘

83 阅读1分钟

        报错如下:

        通过查官方Github可以发现,实际这个是旧版本里的:

         目前新版应该是这个了:

# from pgl.utils import paddle_helper
from pgl.utils import helper

        但对比内容发现,里面的内容变得还是挺大的。如果需要的话,可以手动复制过去。

旧版:github.com/PaddlePaddl…

新版:github.com/PaddlePaddl…

        网上的一些教程代码都是很老旧的,这样就导致其实还有很多其他的问题,比如AttributeError: module 'pgl' has no attribute 'graph_wrapper'。而且目前pip只能装2.0.0版本及以上的包。

         所以得从源码编译安装:Release 1.2 · PaddlePaddle/PGL · GitHub

wget https://github.com/PaddlePaddle/PGL/archive/refs/tags/1.2.zip
unzip 1.2.zip
cd PGL-1.2
python setup.py install

(时不时还是会有奇奇怪怪的问题)