try:
from platform import python_implementation
except ImportError: # pragma: no cover
def python_implementation():
"""Return a string identifying the Python implementation."""
if 'PyPy' in sys.version:
return 'PyPy'
if os.name == 'java':
return 'Jython'
if sys.version.startswith('IronPython'):
return 'IronPython'
return 'CPython'
if __name__ == "__main__":
python_version = python_implementation()
print("The version of your python is ",python_version)
参考链接:https://zhuanlan.zhihu.com/p/264111797