简体   繁体   中英

ImportError: cannot import name 'spawn' from 'distutils'

I am following instructions from here to build raspberry pi kernel Image and root filesystem. Every command output:

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)

The last command, unlike the first 3, ends with an error. I know that this error can be fixed without any problems using

sudo apt-get install python3-distutils

But I don't understand why. The whole build can be done ONLY with Python >= 2.7 and NOT Python 3. But in this particular case, for some reason, it uses the Python 3 library. My question is: Will using the Python 3 library lead to unforeseen build\work time errors? And if yes, is it possible to fix this with some Python 2.x package?
I try to build it with:

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

It looks like the latest bitbake is Python 3 (header in source code ) and has been for nearly 6 years! (change commit)

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

I don't have your environment, but there's a good chance the latest version will work for you (it appears to just be doing a build and is not the final product)

You can either

  • work with Python 3
  • check out a pre-Python3 (2016) version and hope it works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM