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?

和自甴很熟 提交于 2021-02-11 17:11:27

问题


How to avoid the name clash of pymongo's bson module and bson's (py-bson on GitHub) bson module?


回答1:


Install bson package as pybson, see https://github.com/py-bson/bson/issues/70.

I have used

pip uninstall bson

and

pip install pybson

now so that I can use

import pybson as bson

when I want the old name back. If I accidentally need both pymongo's and pybson's import bson, I can use aliases.



来源:https://stackoverflow.com/questions/63068007/name-clash-of-two-different-bson-modules-how-can-i-use-both-pymongos-bson-mod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!