fix: 缺失的 psutil 依赖

This commit is contained in:
RockChinQ
2024-04-02 22:33:06 +08:00
parent 5e69f78f7e
commit fc9a9d2386
3 changed files with 17 additions and 12 deletions

25
main.py
View File

@@ -32,6 +32,20 @@ async def main_entry():
print("已自动安装缺失的依赖包,请重启程序。")
sys.exit(0)
# 检查命令行
import os
if os.name == 'nt':
import psutil
allowed_parent_process = ['cmd.exe', 'powershell.exe', 'wsl.exe']
parent_process = psutil.Process(os.getppid()).name()
if parent_process not in allowed_parent_process:
print("请在命令行中运行此程序。")
input("按任意键退出...")
exit(0)
# 检查配置文件
from pkg.core.bootutils import files
@@ -51,17 +65,6 @@ async def main_entry():
if __name__ == '__main__':
import os
import psutil
if os.name == 'nt':
allowed_parent_process = ['cmd.exe', 'powershell.exe', 'wsl.exe']
parent_process = psutil.Process(os.getppid()).name()
if parent_process not in allowed_parent_process:
print("请在命令行中运行此程序。")
input("按任意键退出...")
exit(0)
# 检查本目录是否有main.py且包含QChatGPT字符串
invalid_pwd = False

View File

@@ -13,6 +13,7 @@ required_deps = {
"tiktoken": "tiktoken",
"yaml": "pyyaml",
"aiohttp": "aiohttp",
"psutil": "psutil",
}

View File

@@ -12,4 +12,5 @@ PyYaml
aiohttp
pydantic
websockets
urllib3
urllib3
psutil