新聞中心
API 和 ABI 版本管理
Cpython 在下列宏中暴露其版本號。 請注意這對應(yīng)于 編譯 用版本代碼,而不是 運行時 使用的版本。

創(chuàng)新互聯(lián)建站專注于網(wǎng)站建設(shè)|企業(yè)網(wǎng)站維護|優(yōu)化|托管以及網(wǎng)絡(luò)推廣,積累了大量的網(wǎng)站設(shè)計與制作經(jīng)驗,為許多企業(yè)提供了網(wǎng)站定制設(shè)計服務(wù),案例作品覆蓋成都柴油發(fā)電機等行業(yè)。能根據(jù)企業(yè)所處的行業(yè)與銷售的產(chǎn)品,結(jié)合品牌形象的塑造,量身開發(fā)品質(zhì)網(wǎng)站。
請參閱 C API 的穩(wěn)定性 查看跨版本的 API 和 ABI 穩(wěn)定情。
PY_MAJOR_VERSION
3 (3.4.1a2 中的第一段)。
PY_MINOR_VERSION
4 (3.4.1a2 中的第二段)。
PY_MICRO_VERSION
1 (3.4.1a2 中第三段的數(shù)字)。
PY_RELEASE_LEVEL
a (3.4.1a2 中第3段的字母)。 可能為 0xA 即 alpha, 0xB 即 beta, 0xC 即 release candidate 或 0xF 即 final。
PY_RELEASE_SERIAL
2 (3.4.1a2 中的末尾數(shù)字)。 零代表最終發(fā)布版。
PY_VERSION_HEX
編碼為單個整數(shù)形式的 Python 版本號。
底層的版本信息可通過按以下方式將其當(dāng)作 32 比特的數(shù)字處理來獲取:
|
字節(jié)串 |
位數(shù)(大端字節(jié)序) |
含意 |
|
|---|---|---|---|
|
1 |
1-8 |
|
|
|
2 |
9-16 |
|
|
|
3 |
17-24 |
|
|
|
4 |
25-28 |
|
|
|
29-32 |
|
|
這樣 3.4.1a2 即十六進制版本號的 0x030401a2 而 3.10.0 即十六進制版本號的 0x030a00f0。
This version is also available via the symbol Py_Version.
const unsigned long Py_Version
Part of the Stable ABI since version 3.11.
The Python runtime version number encoded in a single constant integer, with the same format as the PY_VERSION_HEX macro. This contains the Python version used at run time.
3.11 新版功能.
所有提到的宏都定義在 Include/patchlevel.h。
網(wǎng)站欄目:創(chuàng)新互聯(lián)Python教程:API和ABI版本管理
標(biāo)題路徑:http://fisionsoft.com.cn/article/dphihse.html


咨詢
建站咨詢
