本文最后更新于 2024-04-02,文章内容可能已经过时。

在执行repo命令时候python版本过高的问题,所以摸索了下安装低版本python的方法

warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
Traceback (most recent call last):
  File "../RepoTool/repo", line 904, in <module>
    main(sys.argv[1:])
  File "../RepoTool/repo", line 866, in main
    _Init(args, gitc_init=(cmd == 'gitc-init'))
  File "../RepoTool/repo", line 311, in _Init
    if branch.startswith('refs/heads/'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

一般来说默认安装了python3,可以用以下命令查看安装的python

ls /usr/bin/python*

输入python2,会出来安装的命令,直接输入提示的命令即可:sudo apt install python-minimal