>>> import platform >>> platform.platform() 'Darwin-17.7.0-x86_64-i386-64bit' >>> platform.system() 'Darwin' >>> import platform >>> platform.system() 'Windows' >>> import platform >>> platform.system() 'Linux' 参考: https://www.cnblogs.com/SunshineKimi/p/10890415.html https://blog.csdn.net/lixianlin/article/details/80866598