-
Notifications
You must be signed in to change notification settings - Fork 1
/
check_version.py
33 lines (29 loc) · 984 Bytes
/
check_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
import numpy as np
import platform
import os
def get_memory_info():
if sys.platform == "darwin": # macOS
mem_bytes = os.sysconf('SC_PHYS_PAGES') * os.sysconf('SC_PAGE_SIZE')
mem_gb = mem_bytes / (1024 ** 3)
return f"{mem_gb:.2f} GB"
return "Unknown"
def get_os_version():
if sys.platform == "darwin": # macOS
mac_version = platform.mac_ver()[0]
if not mac_version: # Fallback if mac_ver() is empty
mac_version = platform.release()
return f"macOS {mac_version}"
return platform.system()
# Gather versions and system info
python_version = sys.version.split()[0]
numpy_version = np.__version__
os_version = get_os_version()
processor = platform.processor()
memory = get_memory_info()
# Print the information
print(f"Python version: {python_version}")
print(f"NumPy version: {numpy_version}")
print(f"Operating System: {os_version}")
print(f"Processor: {processor}")
print(f"Memory: {memory}")