fix: Windows控制台强制UTF-8避免emoji编解码报错

This commit is contained in:
qinglong
2026-06-14 19:03:23 +08:00
parent 2c5cd57ad4
commit 846b8a979a
+7
View File
@@ -14,6 +14,13 @@ _sys_path_root = _os.path.dirname(_os.path.abspath(__file__))
if _sys_path_root not in sys.path: if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root) sys.path.insert(0, _sys_path_root)
# Windows 控制台强制 UTF-8 (避免 GBK 编解码 emoji 报错)
try:
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
except Exception:
pass
from services.project_engine import ProjectEngine from services.project_engine import ProjectEngine
from services.pyenv_manager import PyEnvManager from services.pyenv_manager import PyEnvManager
from services.proxy_service import ProxyService from services.proxy_service import ProxyService