mirror of
https://github.com/countbot-ai/CountBot.git
synced 2026-09-14 20:46:47 +08:00
Merge branch 'main' into main
This commit is contained in:
+13
-1
@@ -8,9 +8,21 @@ CountBot 应用启动脚本
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from backend.utils.network import get_local_ips
|
||||
|
||||
# Windows 平台强制 UTF-8 编码,避免 GBK 编码错误
|
||||
if sys.platform == "win32":
|
||||
# Python 3.7+ 支持
|
||||
os.environ["PYTHONIOENCODING"] = "utf-8"
|
||||
# 设置控制台代码页为 UTF-8
|
||||
try:
|
||||
import ctypes
|
||||
kernel32 = ctypes.windll.kernel32
|
||||
kernel32.SetConsoleCP(65001)
|
||||
kernel32.SetConsoleOutputCP(65001)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 添加项目根目录到 Python 路径
|
||||
project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
Reference in New Issue
Block a user