Python 程序中查看 Python version
- 1. Code
- 2. Output
- References
1. Code
#!/usr/bin/env python3
# -*- coding:utf-8 -*-import platform
import sysprint("\nplatform.python_version():")
print(platform.python_version())print("\nsys.version:")
print(sys.version)print("\nsys.version_info:")
print(sys.version_info)
2. Output
/usr/bin/python3.5 /home/strong/pyqt5_workspace/master.pyplatform.python_version():
3.5.2sys.version:
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]sys.version_info:
sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)Process finished with exit code 0
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/