集成Python时,必须匹配多少版本? [英] When integrating Python how much of the version has to match?

查看:52
本文介绍了集成Python时,必须匹配多少版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是关于将Python集成到另一个程序中的.如果我针对Python进行链接,则对于早期的2.x版本,我有一个名为 python27.lib 或类似名称(例如 python26.lib )的导入库.显然,Python 3.x在那里的规则略有更改,因为我在 libs 文件夹中找到了 python3.lib python33.lib .

This question is about integrating Python in another program. If I link against Python, I have an import lib named python27.lib or similar (e.g. python26.lib) for earlier 2.x versions. Apparently Python 3.x has slightly changed the rules there as I find both a python3.lib and a python33.lib in the libs folder.

看一下导入库的成员,很明显,例如2.6和2.7之间没有兼容性.但是,我可以假设从Python 2.7.3导入的lib可以与较旧的Python 2.7 DLL一起使用,例如2.7.2或2.7.1?我不会与应用程序一起部署Python,而是希望基于已设置的Python提供Python集成作为选项.

Looking at the members of the import libs it seems clear that there won't be compatibility between 2.6 and 2.7 for example. However, can I assume that the import lib from Python 2.7.3 can work with older Python 2.7 DLLs, e.g. 2.7.2 or 2.7.1? I won't deploy Python along with my application and instead want to offer the Python integration as an option based on an already set up Python.

奖励问题:考虑到Python 3的名称更改以及 python3.dll 似乎包含函数导出转发器的事实,我可以假设针对进行链接python3.lib 可以与任何从3.0开始的Python 3.x版本一起使用吗?

Bonus question: given the name change in Python 3 and the fact that python3.dll seems to contain function export forwarders, can I assume that linking against python3.lib will work with any Python 3.x version starting with 3.0?

推荐答案

Python的修补程序级别是二进制兼容的,也就是说,当您与2.7.3链接时,二进制文件也可以与其他2.7.x版本一起使用.这在两个发行版之间不起作用(也就是说,您的二进制文件不适用于Python 2.6或3.3).

The patch levels of Python are binary compatible, that is when you link with 2.7.3 the binary will also work with other 2.7.x releases. This won't work between releases (that is, your binary will not work with Python 2.6 or 3.3).

与python3.dll链接时,您可以使用每个python 3.x版本,但在可以使用的C API中受到限制:您只能使用稳定的ABI(如

When you link with python3.dll you can use every python 3.x release, but you're limited in the C APIs that you can use: you can only use the stable ABI (as described here).

这篇关于集成Python时,必须匹配多少版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆