2
我有3个python项目。项目A,项目B和C.项目项目C依赖于,项目A和B有什么办法可以解决Pyxb导致的版本冲突问题
Project C --- depends ---> Project A
Project C --- depends ---> Project B
和项目A和项目B一切都取决于PyXB,他们使用一些生成的架构模块。不幸的是,项目A使用PyXB 1.2.2和项目B使用PyXB 1.2.3
Project A --- depends ---> PyXB 1.2.2
Project B --- depends ---> PyXB 1.2.3
如果你读了这些模块,你会看到
# Version of PyXB used to generate the bindings
_PyXBVersion = '1.2.3'
# Generated bindings are not compatible across PyXB versions
if pyxb.__version__ != _PyXBVersion:
raise pyxb.PyXBVersionError(_PyXBVersion)
和
# Version of PyXB used to generate the bindings
_PyXBVersion = '1.2.2'
# Generated bindings are not compatible across PyXB versions
if pyxb.__version__ != _PyXBVersion:
raise pyxb.PyXBVersionError(_PyXBVersion)
所以,目前项目C有版本冲突问题
Project C --- depends ---> PyXB 1.2.2
^
|
X conflict
|
v
Project C --- depends ---> PyXB 1.2.3
并且由于这些模式模块是手动修改的。很难重新生成它们并应用相同的修改。所以我想知道是否有可能在Python中使用不同的版本导入相同的模块。例如,我想这可能类似于
with import_routing('pyxb', '..packages.pyxb1_2_3'):
import project_a
有没有类似这样的工具?或者我可以在这种情况下使用其他解决方法吗?