简体   繁体   English

在Docker容器中打开搁置时,“ImportError:没有名为_bsddb的模块”

[英]“ImportError: No module named _bsddb” when opening shelve in Docker container

I want to open a shelve inside a Docker container based in Python's official image, python:2.7.9-wheezy . 我想在基于Python的官方图像python:2.7.9-wheezy的Docker容器中打开一个搁架 But I get an import error. 但是我收到导入错误。

syncer/util.py:19: in get_from_shelve
    db = shelve.open(conf.SHELVE_LOCATION)
/usr/local/lib/python2.7/shelve.py:239: in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
/usr/local/lib/python2.7/shelve.py:223: in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
/usr/local/lib/python2.7/anydbm.py:84: in open
    mod = __import__(result)
/usr/local/lib/python2.7/dbhash.py:7: in <module>
    import bsddb
...
E           ImportError: No module named _bsddb

On my host machine the problem isn't there and _bsddb is located at /usr/lib/python2.7/lib-dynload/_bsddb.so . 在我的主机上问题不存在, _bsddb位于/usr/lib/python2.7/lib-dynload/_bsddb.so This file is also available in my Docker container, so I don't understand why it can't be imported. 这个文件也可以在我的Docker容器中使用,所以我不明白为什么它无法导入。

Ignacio Vazquez-Abrams suggest to install db4-devel , but this package isn't available in my container. Ignacio Vazquez-Abrams建议安装db4-devel ,但我的容器中没有此软件包。

How do I open the shelve in the Docker container? 如何打开Docker容器中的搁架?

It seems like you need the libdb4.8-dev package ( link ), but unfortunately this is no longer available since Lucid. 看起来你需要libdb4.8-dev软件包( 链接 ),但不幸的是,自Lucid以来这已经不再可用了。

I have found some possible solutions: 我找到了一些可能的解决方案:

  1. sudo apt-get install libdb5.1++-dev ( link ) sudo apt-get install libdb5.1++-devlink
  2. Installing libdb4.8++ from the Lucid repository ( link ) 从Lucid存储库安装libdb4.8++链接
  3. sudo apt-get install libdb++-dev libminiupnpc-dev ( link , might require reinstalling Python though) sudo apt-get install libdb++-dev libminiupnpc-dev链接 ,可能需要重新安装Python)

Hope it helps! 希望能帮助到你!

(I'm on the train right now, so will definitely test them for you later) (我现在在火车上,所以以后肯定会为你测试一下)


EDIT: Also this page gives a lot of information about supported versions. 编辑: 此页面还提供了有关受支持版本的大量信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ImportError:没有名为_bsddb的模块 - ImportError: No module named _bsddb Pycharm与virtualenv,使用Shelve模块:没有名为_bsddb的模块 - Pycharm with virtualenv, use Shelve module: No module named _bsddb ImportError:直接在Windows中打开.py文件时,没有名为PIL的模块 - ImportError: no module named PIL when opening the .py file directly in Windows ImportError:当模块在那里时,没有模块被命名 - ImportError: No module named when module is there ImportError:使用docker在Jupyter Notebook上未命名模块... - ImportError: No module named… on Jupyter Notebook using docker ImportError:在Windows上的docker工具栏上没有名为...的模块 - ImportError: No module named … on docker toolbar on windows Docker 运行 Flask ImportError: No Module Named Flask - Docker run Flask ImportError: No Module Named Flask docker-compose 以普通用户身份运行时出现错误“ImportError: No module named ssl_match_hostname” - docker-compose gives error "ImportError: No module named ssl_match_hostname" when run as normal user 打开Django Shell时出错-ImportError:没有名为request的模块 - Error while opening django shell - ImportError: No module named request ImportError:在virtualenv中没有名为“ django”的模块 - ImportError: No module named 'django' when in virtualenv
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM