报错日志:
Traceback (most recent call last):
File "/home/liux/projects/android_lineage/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
File "/home/liux/projects/android_lineage/.repo/repo/subcmds/__init__.py", line 35, in <module>
mod = __import__(__name__,
^^^^^^^^^^^^^^^^^^^^
File "/home/liux/projects/android_lineage/.repo/repo/subcmds/help.py", line 20, in <module>
from formatter import AbstractFormatter, DumbWriter
ModuleNotFoundError: No module named 'formatter'
报错原因:
自 Python 3.10
开始移除了 formatter
这个模块.
补救措施
下载旧版本提取模块文件.
wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz
tar zxvf Python-3.9.18.tgz
sudo chmod 644 Python-3.9.18/Lib/formatter.py
sudo chown root:root Python-3.9.18/Lib/formatter.py
sudo cp Python-3.9.18/Lib/formatter.py /usr/lib/python3.11/formatter.py
注意
python
的目标路径, 不同版本有不同;