-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheckLibs.py
42 lines (35 loc) · 1.7 KB
/
checkLibs.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
34
35
36
37
38
39
40
41
42
def CheckLib(libraries):
not_installed = []
special_imports = {
# Nome del modulo effettivo per importare PyQtWebEngine
'PyQtWebEngine': 'PyQt5.QtWebEngineWidgets',
'paho-mqtt':'paho.mqtt.client',
'qtwidgets':'PyQt5.QtWidgets'
}
for library in libraries:
# Usa un nome di importazione speciale se presente
module_to_import = special_imports.get(library, library)
try:
__import__(module_to_import)
print(f"The library '{library}' is installed.")
except ImportError:
print(f"The library '{library}' is NOT installed.")
not_installed.append(library)
if not_installed:
print("\nThe following libraries are not installed. Please install the following libraries:")
for lib in not_installed:
print(f"- {lib}")
else:
print("\nAll libraries are installed.")
if __name__ == "__main__":
# Example usage:
libraries_to_check = ['numpy', 'pandas', 'matplotlib', 'prophet', 'requests', 'asyncio',
'aiohttp', 'networkx', 'folium', 'pydot',
'geopy', 'simpy', 'pymongo', 'snowflake', 'PyQt5', 'PyQtWebEngine', 'osmnx', 'mesa', 'openpyxl', 'paho-mqtt', 'qtwidgets', 'tensorflow']
CheckLib(libraries_to_check)
if __name__ == "__main__":
# Example usage:
libraries_to_check = ['numpy', 'pandas', 'matplotlib', 'prophet', 'requests', 'asyncio',
'aiohttp', 'networkx', 'folium', 'pydot',
'geopy', 'simpy', 'pymongo', 'snowflake', 'PyQt5', 'PyQtWebEngine', 'osmnx', 'mesa', 'openpyxl', 'paho-mqtt', 'qtwidgets', 'tensorflow']
CheckLib(libraries_to_check)