• Mac最新系统bssdb BUG


    这个bug在Mac OS更新到10.14时候出现,当前系统版本
    ➜  git:(master) sw_vers
    ProductName:	Mac OS X
    ProductVersion:	10.14
    BuildVersion:	18A391
    
    Error info:
      File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
        Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
      File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
        mod = __import__(result)
      File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in <module>
        import bsddb
      File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
        import _bsddb
    ImportError: No module named _bsddb
    
    
    修正方式:

    将dbhash.py 这个文件里import bsddb 改为 import bsddb3 as bsddb,我virutalenv的dbhash文件位置在:

    /usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py
    
    try:
        #import bsddb
        import bsddb3 as bsddb
    except ImportError:
        # prevent a second import of this module from spuriously succeeding
        del sys.modules[__name__]
        raise
    
    
  • 相关阅读:
    21.面向对象:多态与多态性、面向对象进阶:内置方法,反射。异常处理
    mysql 复习
    Python之math模块
    mysql数据类型转换
    Remmina
    JWT校验流程源码
    JWT签发token
    elasticsearch使用
    Flask基础
    初识Flask
  • 原文地址:https://www.cnblogs.com/xiaoxiaoleo/p/10287758.html
Copyright © 2020-2023  润新知