You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Curriculum_Design/start_app_safe.sh

29 lines
1018 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/bash
# MagicWord PyQt5 安全启动脚本
# 此脚本自动设置所有必要的环境变量并启动应用
echo "🚀 正在启动 MagicWord 应用..."
# 设置PyQt5环境变量
export QT_PLUGIN_PATH="/Users/maziang/Documents/CodingWorkPlace/Code/Curriculum_Design/.venv/lib/python3.9/site-packages/PyQt5/Qt5/plugins"
export QT_QPA_PLATFORM_PLUGIN_PATH="/Users/maziang/Documents/CodingWorkPlace/Code/Curriculum_Design/.venv/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms"
export QT_QPA_PLATFORM="cocoa"
export QT_MAC_WANTS_LAYER="1"
export QT_LOGGING_RULES="qt.qpa.*=false"
# 检查虚拟环境
if [ -z "$VIRTUAL_ENV" ]; then
echo "⚠️ 虚拟环境未激活,正在激活..."
source .venv/bin/activate
fi
# 检查PyQt5是否安装
python -c "import PyQt5.QtWidgets" 2>/dev/null
if [ $? -ne 0 ]; then
echo "❌ PyQt5未正确安装正在修复..."
python fix_pyqt5_complete.py
fi
# 启动应用
echo "✅ 环境设置完成,正在启动应用..."
cd src && python main.py