sys.version
A string containing the version number of the Python interpreter plus additional information on the build number and compiler used. This string is displayed when the interactive interpreter is started. Do not extract version information out of it, rather, use version_info and the functions provided by the platform module.
查下manual就可以知道了,有多个类似变量可用
如果是给人读,用
sys.version,如果是给机器比较,用
sys.version_info,如果是判断是不是 PyPy 等第三方实现,用
sys.implementation(要 Python 3.3)。例子: