如何获得Python编译的选项列表? [英] How to get the list of options that Python was compiled with?
本文介绍了如何获得Python编译的选项列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您可以通过各种方式编译Python。我想知道我的Python是编译哪些选项。
You can compile Python in various ways. I'd like to find out with which options my Python was compiled.
混凝土使用情况:是我的Python与readline编译?
我知道我可以通过import readline来看到这一点,但是我想看一下我的Python二进制文件的编译设置列表。
Concrete use-case: was my Python compiled with readline? I know I can see this by doing "import readline", but I'd like to see a list of compilation setting for my Python binary.
:
我的意思是Python可执行文件和自己写的不源代码。
推荐答案
有一个模块来查看系统配置
There is a module to see the system config
import sysconfig
print(sysconfig.get_config_vars())
它提供了一个界面来获取单个变量。
It offers an interface to get individual variables as well.
sysconfig.get_config_var('HAVE_LIBREADLINE')
在python2.7之前,您必须使用
before python2.7, you have to use
import distutils.sysconfig
print distutils.sysconfig.get_config_vars()
这篇关于如何获得Python编译的选项列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文