gpt4 book ai didi

c++ - python的版本检查

转载 作者:行者123 更新时间:2023-11-30 21:34:54 25 4
gpt4 key购买 nike

我需要使用在 Windows 10 中运行的 C 程序而不是在我的 Python 程序中检查安装的 Python 版本是 32 位还是 64 位。

如何使用 C 代码检查 Python 架构?

最佳答案

char *cmd = "python -c \"import sys,platform ;exit(platform.architecture()[0]==\"32bit\")\""
int ret = system(cmd);

对于 32 位,ret 为 1;对于 64 位,ret 为 0

关于c++ - python的版本检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57392102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com