12

Quite simply, is there a python equivalent to php's phpinfo();? If so, what is it and how do I use it (a link to a reference page would work great).

4

5 回答 5

4

看看这个!

pyinfo() 一个好看的类似phpinfo的python脚本

于 2010-08-09T13:01:37.100 回答
3

Did you try this out: http://www.webhostingtalk.com/showpost.php?s=f55e18d344e3783edd98aef5be809ac8&p=4632018&postcount=4

于 2010-04-03T19:28:37.107 回答
2

There is nothing directly comparable to phpinfo(), but you can get some bits of information ...

>>> import sys
>>> sys.version
'2.6.4 (r264:75706, Feb  6 2010, 01:49:44) \n[GCC 4.2.1 (Apple Inc. build 5646)]'

>>> sys.platform
'darwin'

>>> sys.modules.keys()
['copy_reg', 'sre_compile', '_sre', 'encodings', 'site', ... ]

>>> import os
>>> os.name
'posix'

>>> import platform
>>> platform.architecture()
('32bit', '')

>>> platform.machine()
'i386'

...
于 2010-04-03T19:27:28.893 回答
1

Afaik there is no similar function. However, the platform module allows you to access some basic information about the machine, OS and Python.

于 2010-04-03T19:26:46.333 回答
0

phpinfo 打印有关正在运行的 PHP 版本、加载的模块等的信息。

AFAIK Python没有转储完整配置的便捷功能。

但是你应该看看sys包装。

import sys

# print all imported modules since start
print sys.modules

# print load path
print sys.path

...

查看 Python 的sys-library 参考

于 2010-04-03T19:30:37.630 回答