fix: mongodb.zip 无法解压
fix:更换执行命令的方法 fix:当 db 不存在时自动创建 feat: 一键安装完成后启动麦麦
This commit is contained in:
41
run.py
41
run.py
@@ -45,21 +45,15 @@ def run_cmd(command: str, open_new_window: bool = True):
|
|||||||
command (str): 指定要运行的命令
|
command (str): 指定要运行的命令
|
||||||
open_new_window (bool): 指定是否新建一个 cmd 窗口运行
|
open_new_window (bool): 指定是否新建一个 cmd 窗口运行
|
||||||
"""
|
"""
|
||||||
creationflags = 0
|
|
||||||
if open_new_window:
|
if open_new_window:
|
||||||
creationflags = subprocess.CREATE_NEW_CONSOLE
|
command = "start " + command
|
||||||
subprocess.Popen(
|
subprocess.Popen(command, shell=True)
|
||||||
[
|
|
||||||
"cmd.exe",
|
|
||||||
"/c",
|
|
||||||
command,
|
|
||||||
],
|
|
||||||
creationflags=creationflags,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def run_maimbot():
|
def run_maimbot():
|
||||||
run_cmd(r"napcat\NapCatWinBootMain.exe 10001", False)
|
run_cmd(r"napcat\NapCatWinBootMain.exe 10001", False)
|
||||||
|
if not os.path.exists(r"mongodb\db"):
|
||||||
|
os.makedirs(r"mongodb\db")
|
||||||
run_cmd(
|
run_cmd(
|
||||||
r"mongodb\bin\mongod.exe --dbpath=" + os.getcwd() + r"\mongodb\db --port 27017"
|
r"mongodb\bin\mongod.exe --dbpath=" + os.getcwd() + r"\mongodb\db --port 27017"
|
||||||
)
|
)
|
||||||
@@ -86,26 +80,29 @@ def install_mongodb():
|
|||||||
for data in resp.iter_content(chunk_size=1024):
|
for data in resp.iter_content(chunk_size=1024):
|
||||||
size = file.write(data)
|
size = file.write(data)
|
||||||
bar.update(size)
|
bar.update(size)
|
||||||
extract_files("mongodb.zip", "mongodb")
|
extract_files("mongodb.zip", "mongodb")
|
||||||
print("MongoDB 下载完成")
|
print("MongoDB 下载完成")
|
||||||
os.remove("mongodb.zip")
|
os.remove("mongodb.zip")
|
||||||
choice = input(
|
choice = input(
|
||||||
"是否安装 MongoDB Compass?此软件可以以可视化的方式修改数据库,建议安装(Y/n)"
|
"是否安装 MongoDB Compass?此软件可以以可视化的方式修改数据库,建议安装(Y/n)"
|
||||||
).upper()
|
).upper()
|
||||||
if choice == "Y" or choice == "":
|
if choice == "Y" or choice == "":
|
||||||
install_mongodb_compass()
|
install_mongodb_compass()
|
||||||
|
|
||||||
|
|
||||||
def install_mongodb_compass():
|
def install_mongodb_compass():
|
||||||
run_cmd(
|
run_cmd(
|
||||||
r"powershell Start-Process powershell -Verb runAs 'Set-ExecutionPolicy RemoteSigned'")
|
r"powershell Start-Process powershell -Verb runAs 'Set-ExecutionPolicy RemoteSigned'"
|
||||||
|
)
|
||||||
input("请在弹出的用户账户控制中点击“是”后按任意键继续安装")
|
input("请在弹出的用户账户控制中点击“是”后按任意键继续安装")
|
||||||
run_cmd(r"powershell mongodb\bin\Install-Compass.ps1")
|
run_cmd(r"powershell mongodb\bin\Install-Compass.ps1")
|
||||||
input("Compass 安装完成后请按任意键继续后续安装")
|
input("按任意键启动麦麦")
|
||||||
|
input("如不需要启动此窗口可直接关闭,无需等待 Compass 安装完成")
|
||||||
|
install_mongodb_compass()
|
||||||
|
|
||||||
|
|
||||||
def install_napcat():
|
def install_napcat():
|
||||||
run_cmd("start https://github.com/NapNeko/NapCatQQ/releases")
|
run_cmd("start https://github.com/NapNeko/NapCatQQ/releases", False)
|
||||||
print("请检查弹出的浏览器窗口,点击**第一个**蓝色的“Win64无头” 下载 napcat")
|
print("请检查弹出的浏览器窗口,点击**第一个**蓝色的“Win64无头” 下载 napcat")
|
||||||
napcat_filename = input(
|
napcat_filename = input(
|
||||||
"下载完成后请把文件复制到此文件夹,并将**不包含后缀的文件名**输入至此窗口,如 NapCat.32793.Shell:"
|
"下载完成后请把文件复制到此文件夹,并将**不包含后缀的文件名**输入至此窗口,如 NapCat.32793.Shell:"
|
||||||
@@ -136,4 +133,4 @@ if __name__ == "__main__":
|
|||||||
run_maimbot()
|
run_maimbot()
|
||||||
elif choice == "3":
|
elif choice == "3":
|
||||||
run_maimbot()
|
run_maimbot()
|
||||||
run_cmd("python src/gui/reasoning_gui.py")
|
run_cmd(r"python src\gui\reasoning_gui.py")
|
||||||
|
|||||||
Reference in New Issue
Block a user