簡體   English   中英

ImportError:無法從“distutils”導入名稱“spawn”

[英]ImportError: cannot import name 'spawn' from 'distutils'

我按照此處的說明構建樹莓派 kernel 映像和根文件系統。 每個命令 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)

與前 3 個不同,最后一個命令以錯誤結束。 我知道可以修復此錯誤而不會出現任何問題

sudo apt-get install python3-distutils

但我不明白為什么。 整個構建只能使用 Python >= 2.7 而不是 Python 3 完成。但在這種特殊情況下,出於某種原因,它使用 ZA7F5F35426B9274117FC9231B5638 庫。 我的問題是:使用 Python 3 庫會導致無法預料的構建\工作時間錯誤嗎? 如果是的話,是否可以用一些 Python 2.x package 來解決這個問題?
我嘗試使用以下方法構建它:

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

看起來最新的 bitbake 是 Python 3 (源代碼中的 header )並且已經使用了將近 6 年! (更改提交)

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

我沒有你的環境,但最新版本很有可能對你有用(它似乎只是在構建而不是最終產品)

你可以

  • 使用 Python 3
  • 查看一個 pre-Python3 (2016) 版本,希望它能正常工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM