使用pipoe构建Yocto pyinstaller recipe时报setuptools.bbclass继承错误求助
错误原因排查
ERROR: ParseError at /home/yasmine/yocto/poky/meta-pyinst/recipes-pyinstaller/pyinstaller/python-altgraph_0.17.bb:16: Could not inherit file classes/setuptools.bbclass
出现该报错的核心原因是Yocto版本的类命名规则变更,具体如下:
- Yocto 3.1(Dunfell)及更早版本中存在
setuptools.bbclass,用于适配Python2的setuptools构建逻辑 - 从Yocto 3.2(Gatesgarth)版本开始,官方完全移除了旧的
setuptools.bbclass,Python3包的构建统一使用setuptools3.bbclass - pipoe工具默认生成的recipe适配旧版Yocto规则,会自动写入
inherit pypi setuptools配置,在新版本Yocto环境下就会出现类找不到的报错
解决方法
- 单文件修正:打开报错的
python-altgraph_0.17.bb,将第16行的inherit pypi setuptools修改为inherit pypi setuptools3即可 - 批量生成适配:后续使用pipoe生成Python3相关recipe时,直接指定继承类避免重复修改,命令如下:
pipoe --pkg <包名> --python python3 --inherit "pypi setuptools3" - 依赖校验:确认
conf/bblayers.conf中已正确引入meta层和meta-python层,避免后续出现其他依赖类找不到的问题 - 验证修改:执行如下命令验证单包编译正常,再继续编译pyinstaller主recipe:
bitbake python-altgraph
如果使用的是Yocto 3.1及更早版本仍出现该报错,排查bblayers.conf中是否正确引入了poky核心meta层,确认BBPATH配置包含类文件的搜索路径。
内容的提问来源于stack exchange,提问作者Yasmine Bgh
相关产品推荐
相关产品推荐

