ImportError:没有名为bb的模块

时间:2016-04-04 06:27:04

标签: python package packages bitbake openembedded

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

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

然后导出以下varibales

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并在myhelloworld目录中创建openembedded-core/build/目录,然后执行

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

2 个答案:

答案 0 :(得分:6)

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

你应该做什么:

  1. 克隆存储库。

    15,45
    12,00
    14,20
    14,54
    

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

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

    请参阅corresponding release branches of OE-core and bitbake

  2. 设置构建环境:

    git checkout jethro
    cd bitbake
    git checkout 1.28
    cd ..
    
  3. 配置构建。

    即。在. oe-init-build-env

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

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

    build/conf/local.conf
  6. 更新:请注意,正式针对bitbake core-image-minimal bitbake myehelloworld 进行测试的Poky的最新版本为Ubuntu 10.04。以后的版本可能会在该主机上出现问题,我建议更新到更新的LTS版本。

    更新2:您的新错误显示Dylan。 Bitbake将首先查找ImportError: No module named pysqlite2。在build-host sqlite3

    上安装它

答案 1 :(得分:-3)

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