【问题标题】:Name clash of two different bson modules - How can I use both pymongo's bson module and bson's bson module in the same script?两个不同 bson 模块的名称冲突 - 如何在同一个脚本中同时使用 pymongo 的 bson 模块和 bson 的 bson 模块?
【发布时间】:2020-11-13 23:47:24
【问题描述】:

如何避免pymongo的bson模块和bson(GitHub上的py-bson)的bson模块名称冲突?

【问题讨论】:

    标签: python python-3.x package pymongo bson


    【解决方案1】:

    bson包安装为pybson,见https://github.com/py-bson/bson/issues/70

    我用过

    pip uninstall bson

    pip install pybson

    现在我可以使用

    import pybson as bson

    当我想要恢复旧名称时。如果我不小心同时需要 pymongopybsonimport bson,我可以使用别名。

    【讨论】:

      猜你喜欢
      • 2016-10-05
      • 2017-08-04
      • 2015-04-23
      • 1970-01-01
      • 2017-12-05
      • 2015-03-24
      • 1970-01-01
      • 2016-08-19
      • 2016-10-20
      相关资源
      最近更新 更多