最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to detect MS Visual C++ runtime version mismatches from third-party libraries when importing Python modules? - Stack Overflo

programmeradmin0浏览0评论

I've run into a weird case of incompatibility between:

  • A Python module (PySide6) that bundles its own version of the Visual C++ runtime
  • Our own compiled modules that are compiled against the latest Visual C++ runtime

At some point we upgraded Visual C++, and the second ended up being newer than the first, meaning that according to MS Visual C++ compatibility rules:

  • Importing PySide6, then our module makes the interpreter crash: by default our module tries to reuse the old runtime version already loaded from PySide6, and that configuration is not supported because it's compiled for a newer runtime.
  • Importing our module, then PySide6 works perfectly fine: our module uses the newer system runtime and PySide6 keeps on using its custom runtime, both configurations being supported.

Aside from doing the same thing as PySide6 (bundling the runtime inside of our module) or forcing our module to load the system runtime manually, is there a way to detect that this is happening before the import and warn/crash with a proper error message?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论