1 답변
-
cpu 갯수, cpu 종류 ram 용량 정도는 기본 라이브러리로 커버가 됩니다만 좀 더 세부적인 시스템 정보는 네이티브 라이브러리를 사용해야 될 수 있습니다.
platform 모듈을 확인해보세요. https://docs.python.org/3/library/platform.html
psutil 모듈도 참고하세요. https://github.com/giampaolo/psutil
import platform platform.machine() Out[3]: 'x86_64' platform.version() Out[4]: '#99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017' platform.platform() Out[5]: 'Linux-4.4.0-78-generic-x86_64-with-LinuxMint-18.1-serena' platform.uname() Out[6]: uname_result(system='Linux', node='allinux-note', release='4.4.0-78-generic', version='#99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017', machine='x86_64', processor='x86_64') platform.system() Out[7]: 'Linux' platform.processor() Out[8]: 'x86_64' import os print(str(os.popen('free -t -m').readlines())) [' total used free shared buff/cache available\n', 'Mem: 7901 1128 4534 409 2239 6017\n', 'Swap: 9535 0 9535\n', 'Total: 17437 1128 14070\n']
댓글 입력