- Removed trailing whitespace and ensured files end with a single newline in cleanup_unused_files.py. - Added fix_trailing_whitespace.py to batch remove trailing whitespace from Python files. - Updated install_dependencies.py to improve dependency installation prompts. - Cleaned up pick_coords.py by removing unnecessary whitespace and improving code readability. - Enhanced region_selector.py by disabling specific pylint checks for better compatibility with third-party libraries. - Improved WPS流程图生成工具.py by cleaning up whitespace and enhancing readability. - Updated __init__.py in typings to remove unnecessary lines. - Modified app.js to adjust default configuration values and clean up unused code.
68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""检查项目依赖库的安装状态"""
|
|
|
|
import sys
|
|
import io
|
|
|
|
# 设置UTF-8输出
|
|
if sys.platform == 'win32':
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
|
|
|
dependencies = {
|
|
'PIL': ('Pillow', 'Image Processing'),
|
|
'cv2': ('opencv-python', 'Computer Vision'),
|
|
'numpy': ('numpy', 'Numerical Computing'),
|
|
'paddleocr': ('paddleocr', 'OCR Recognition'),
|
|
'paddlepaddle': ('paddlepaddle', 'Deep Learning'),
|
|
'ttkbootstrap': ('ttkbootstrap', 'GUI Framework'),
|
|
'easyocr': ('easyocr', 'OCR Recognition (Optional)'),
|
|
}
|
|
|
|
print("=" * 60)
|
|
print("Dependency Check Report")
|
|
print("=" * 60)
|
|
print(f"Python Version: {sys.version}\n")
|
|
|
|
missing = []
|
|
installed = []
|
|
optional_missing = []
|
|
|
|
for module_name, (package_name, description) in dependencies.items():
|
|
try:
|
|
__import__(module_name)
|
|
print(f"[OK] {package_name:20s} ({description:25s}) - Installed")
|
|
installed.append(package_name)
|
|
except ImportError:
|
|
if module_name == 'easyocr':
|
|
print(f"[OPT] {package_name:20s} ({description:25s}) - Not Installed (Optional)")
|
|
optional_missing.append(package_name)
|
|
else:
|
|
print(f"[MISS] {package_name:20s} ({description:25s}) - Not Installed")
|
|
missing.append(package_name)
|
|
except Exception as e:
|
|
print(f"[ERR] {package_name:20s} - Error: {e}")
|
|
|
|
print("\n" + "=" * 60)
|
|
print("Summary")
|
|
print("=" * 60)
|
|
print(f"Installed: {len(installed)}/{len(dependencies)}")
|
|
if missing:
|
|
print(f"\nMissing Required Dependencies ({len(missing)}):")
|
|
for pkg in missing:
|
|
print(f" - {pkg}")
|
|
if optional_missing:
|
|
print(f"\nMissing Optional Dependencies ({len(optional_missing)}):")
|
|
for pkg in optional_missing:
|
|
print(f" - {pkg}")
|
|
|
|
if missing:
|
|
print("\nInstall Command:")
|
|
print(f"pip install {' '.join(missing)}")
|
|
print("\nOr use:")
|
|
print(" pip install -r requirements.txt")
|
|
sys.exit(1)
|
|
else:
|
|
print("\n[SUCCESS] All required dependencies are installed!")
|
|
sys.exit(0)
|