导入错误:无法从'distutils'导入名称'spawn'



我按照这里的说明构建树莓pi内核映像和根文件系统。每个命令输出:

1.

repo init -u https://code.rdkcentral.com/r/manifests -b rdk-next -m rdkb-extsrc.xml
...
repo has been initialized in /home/username
repo sync -j4 --no-clone-bundle
...
repo sync has finished successfully.
source meta-cmf-raspberrypi/setup-environment
...
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
$ bitbake rdk-generic-broadband-image
/home/username/openembedded-core/bitbake/lib/bb/fetch2/clearcase.py:161: SyntaxWarning: "is" with a literal. Did you mean "=="?
if command is 'mkview':
/home/username/openembedded-core/bitbake/lib/bb/fetch2/clearcase.py:168: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif command is 'rmview':
/home/username/openembedded-core/bitbake/lib/bb/fetch2/clearcase.py:172: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif command is 'setcs':
Traceback (most recent call last):
File "/home/username/openembedded-core/bitbake/bin/bitbake", line 31, in <module>
import bb
File "/home/username/openembedded-core/bitbake/lib/bb/__init__.py", line 79, in <module>
from bb import fetch2 as fetch
File "/home/username/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 1794, in <module>
from . import clearcase
File "/home/username/openembedded-core/bitbake/lib/bb/fetch2/clearcase.py", line 73, in <module>
from   distutils import spawn
ImportError: cannot import name 'spawn' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)

与前3个命令不同,最后一个命令以错误结束。我知道使用可以在没有任何问题的情况下修复这个错误

sudo apt-get install python3-distutils

但我不明白为什么。整个构建只能使用Python完成>=2.7而非Python 3。但在这种特殊情况下,出于某种原因,它使用了Python3库。我的问题是:使用Python 3库会导致无法预见的构建\工作时间错误吗?如果是的话,有可能用一些Python2.x包来解决这个问题吗
我试着用构建它

$ which python
/usr/bin/python
$ python -V
Python 2.7.18

看起来最新的bitbake是Python 3(源代码中的头(,已经使用了近6年!(变更提交(

#!/usr/bin/env python3
#
...

我没有你的环境,但最新版本很有可能适用于你(它似乎只是在进行构建,而不是最终产品(

你可以选择

  • 使用Python 3
  • 看看Python3(2016(之前的版本,希望它能起作用

最新更新