CoCalc Shared Files07. Jupyter-ostalo / verzije.pyOpen in CoCalc with one click!
Author: Ivica Nakić
1
# -*- coding: utf-8 -*-
2
"""
3
Jednostavan modul koji služi za ispis osnovnih informacija o sustavu i instaliranim python paketima.
4
"""
5
from platform import python_version, python_compiler, architecture
6
from platform import system as platform_system
7
from multiprocessing import cpu_count
8
from pkg_resources import get_distribution
9
from IPython.display import HTML
10
11
def info_packages(pkgs):
12
"""Koje verzije paketa"""
13
out ="<table>"
14
packages = pkgs.split(',')
15
for p in packages:
16
out += "<tr><td><strong>{}</strong> verzija</td><td>{}</td></tr>".format(p, get_distribution(p).version)
17
out += "</table>"
18
return out
19
def print_sysinfo():
20
"""Osnovne informacije o Pythonu i računalu"""
21
out ="<table>"
22
out += "<tr><td><strong>Python verzija</strong></td><td>{}</td></tr>".format(python_version())
23
out += "<tr><td><strong>kompajler</strong></td><td>{}</td></tr>".format(python_compiler())
24
out += "<tr><td><strong>sustav</strong></td><td>{}</td></tr>".format(platform_system())
25
out += "<tr><td><strong>broj CPU-a</strong></td><td>{}</td></tr>".format(cpu_count())
26
out += "<tr><td><strong>interpreter</strong></td><td>{}</td></tr>".format(architecture()[0])
27
out += "</table>"
28
return out