Skip to content

Commit

Permalink
fix: 缺失的 psutil 依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Apr 2, 2024
1 parent 5e69f78 commit fc9a9d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
25 changes: 14 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/core/bootutils/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"tiktoken": "tiktoken",
"yaml": "pyyaml",
"aiohttp": "aiohttp",
"psutil": "psutil",
}


Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ PyYaml
aiohttp
pydantic
websockets
urllib3
urllib3
psutil

0 comments on commit fc9a9d2

Please sign in to comment.