ImportError: No module named bb

ImportError: No module named bb

为了创建一个 helloworld .ipk 包,如 here 所述,我将 bitbakeOpenEmbedded 克隆为

git clone git://git.openembedded.org/bitbake
git clone git://git.openembedded.org/openembedded

然后导出以下变量

export OEBASE=/media/sda3/open_env/
export PATH=$OEBASE/bitbak/ebin:$PATH
export BBPATH=$OEBASE/build:$OEBASE/openembedded
export BB_ENV_EXTRAWHITE="OEBASE"

当我 运行 执行以下命令时,出现以下错误:

bitbake -b packages/myhelloworld/myhelloworld_0.1.bb

Traceback (most recent call last):
  File "/usr/bin/bitbake", line 35, in <module>
    import bb
ImportError: No module named bb

我在 ubuntu 10.04 上这样做。我在这里缺少什么?

编辑:

正如答案中给出的那样,我执行了以下命令并收到如下错误:

git clone git://git.openembedded.org/openembedded-core
cd openembedded-core
git clone git://git.openembedded.org/bitbake

cd ..
git checkout dylan
cd bitbake
git checkout 1.18
cd ..

. oe-init-build-env

修改build/conf/local.conf并在openembedded-core/build/目录中创建myhelloworld目录,然后执行

bitbake myhelloworld/

我收到如下错误:

Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Pseudo is not present but is required, building this first before the main build
Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Traceback (most recent call last):
  File "/media/sda3/open_env/openembedded-core/bitbake/bin/bitbake", line 34, in <module>
    import bb
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py:104: RuntimeWarning: Parent module 'bb' not found while handling absolute import
  from bb.msg import BBLogFormatter
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/home/python-2.7.3/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/event.py", line 104, in print_ui_queue
    from bb.msg import BBLogFormatter
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/__init__.py", line 77, in <module>
    from bb import fetch2 as fetch
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 38, in <module>
    import bb.persist_data, bb.utils
  File "/media/sda3/open_env/openembedded-core/bitbake/lib/bb/persist_data.py", line 35, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ImportError: No module named pysqlite2

您缺少 bb 模块。您需要从您的需求文件或手动使用 pip 安装所有依赖项。 这可能对你有帮助。 http://python-packaging-user-guide.readthedocs.org/en/latest/installing/#requirements-for-installing-packages

您正在将最近的 bitbake 与 OpenEmbedded classic 混合;请不要那样做。您还尝试手动设置构建环境,也请避免使用该环境。任何新的开发都应该基于OpenEmbedded Core。

你应该做什么:

  1. 克隆存储库。

    git clone git://git.openembedded.org/openembedded-core
    cd openembedded-core
    git clone git://git.openembedded.org/bitbake
    

    如果你想使用某个分支,例如jethro

    git checkout jethro
    cd bitbake
    git checkout 1.28
    cd ..
    

    参见corresponding release branches of OE-core and bitbake

  2. 设置构建环境:

    . oe-init-build-env
    
  3. 配置构建。

    即在 build/conf/local.conf.

  4. 中设置正确的机器等
  5. 建造!

    现在做你想要的,例如任何一个:

    bitbake core-image-minimal
    bitbake myehelloworld
    

更新:请注意,Poky 的最后一个版本(Poky 正式针对 Ubuntu 10.04 进行了测试是 Dylan)。以后的版本很可能在该主机上有问题,我建议更新到更新的 LTS 版本。

更新 2:您的新错误显示 ImportError: No module named pysqlite2。 Bitbake 将首先查找 sqlite3。在你的构建主机上安装它 apt-get install libsqlite3-dev