MetaCore-startup/MetaCore/验证安装.py
2025-10-11 09:24:06 +08:00

79 lines
2.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
验证MetaCore安装是否正确
"""
import sys
import os
def main():
print("=" * 50)
print("🧪 MetaCore安装验证")
print("=" * 50)
# 检查Python版本
print(f"🐍 Python版本: {sys.version}")
print(f"📁 Python路径: {sys.executable}")
# 检查PyQt5
try:
import PyQt5
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR
print(f"✅ PyQt5版本: {PYQT_VERSION_STR}")
print(f"✅ Qt版本: {QT_VERSION_STR}")
# 测试创建应用
app = QApplication([])
print("✅ PyQt5可以正常创建应用程序")
app.quit()
except ImportError as e:
print(f"❌ PyQt5导入失败: {e}")
return False
# 检查项目文件
required_files = [
'main.py',
'ui/main_window.py',
'data/project_manager.py'
]
print("\n📁 检查项目文件:")
for file_path in required_files:
if os.path.exists(file_path):
print(f"{file_path}")
else:
print(f"{file_path} (缺失)")
return False
# 测试模块导入
print("\n📦 测试模块导入:")
try:
sys.path.insert(0, os.getcwd())
from ui.main_window import MainWindow
from data.project_manager import ProjectManager
print("✅ 所有模块导入成功")
except Exception as e:
print(f"❌ 模块导入失败: {e}")
return False
print("\n" + "=" * 50)
print("🎉 验证完成!")
print("✅ MetaCore安装正确可以正常运行")
print("\n🚀 启动命令:")
print(" python main.py")
print(" 或双击: 启动MetaCore.bat")
print("=" * 50)
return True
if __name__ == "__main__":
success = main()
if not success:
print("\n❌ 验证失败,请检查安装")
input("按Enter键退出...")
else:
input("按Enter键退出...")