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

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


目前新版应该是这个了:
# from pgl.utils import paddle_helper
from pgl.utils import helper

但对比内容发现,里面的内容变得还是挺大的。如果需要的话,可以手动复制过去。
旧版:https://github.com/PaddlePaddle/PGL/blob/main/legacy/pgl/utils/paddle_helper.py
新版:https://github.com/PaddlePaddle/PGL/blob/main/pgl/utils/helper.py
网上的一些教程代码都是很老旧的,这样就导致其实还有很多其他的问题,比如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
(时不时还是会有奇奇怪怪的问题)
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
