repo报错
错误:

错误类型: ModuleNotFoundError: No module named 'formatter'
原因: Python 3.x版本中,formatter模块已经被移除,但在repo工具的代码中仍在尝试导入它
解决方案
方法1:使用Python 2.x运行repo
# 检查Python版本
python --version
# 如果有Python 2,可以尝试:
python2 `which repo` init -u ssh://git@192.168.1.7:2222/rk3568_linux5_10/manifest.git -b xxx-RK3568-MB -m xxx-RK3568-MB.xml
方法2:更新repo工具
# 删除现有的repo目录
rm -rf .repo
# 重新初始化并自动下载最新版本的repo
repo init -u ssh://git@192.168.1.7:2222/rk3568_linux5_10/manifest.git -b xxx-RK3568-MB -m xxx-RK3568-MB.xml --repo-url=https://gerrit.googlesource.com/git-repo
方法3:手动修复(如果必须使用当前版本)
修改报错文件 /home/yangx/linux2/yangx/RK3568/xxxxxx-RK3568-S-V1_00/.repo/repo/subcmds/help.py 中的导入语句:
将:
from formatter import AbstractFormatter, DumbWriter
替换为:
try:
from formatter import AbstractFormatter, DumbWriter
except ImportError:
# Python 3.6+ compatibility
from html import escape as html_escape
# 或者使用其他替代方案
本文来自博客园,作者:潇汀,转载请注明原文链接:https://www.cnblogs.com/allalonewithyou/p/19140354,个人邮箱:yaonie4444@foxmail.com

浙公网安备 33010602011771号