File size: 1,438 Bytes
ebb79f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@echo off
setlocal

:: Specify the path to your Python script
set SCRIPT_PATH=wan_lora_trainer_gui.py

:: Check if Python is installed
echo Checking for Python...
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo Python not found. Automatic installation is not possible via bat file.
    echo Please install Python manually from the official website: https://www.python.org/
    pause
    exit /b 1
)

:: Check for pip (tool for installing Python packages)
echo Checking for pip...
python -m ensurepip >nul 2>&1
python -m pip --version >nul 2>&1
if %errorlevel% neq 0 (
    echo pip not found. Installing pip...
    python -m ensurepip --upgrade
    python -m pip install --upgrade pip
    if %errorlevel% neq 0 (
        echo Failed to install pip. Please check your Python installation.
        pause
        exit /b 1
    )
)

:: Check for tkinter
echo Checking for tkinter...
python -c "import tkinter" >nul 2>&1
if %errorlevel% neq 0 (
    echo tkinter module not found. Attempting to install...
    python -m pip install tk
    if %errorlevel% neq 0 (
        echo Failed to install tkinter. There might be an issue with permissions.
        pause
        exit /b 1
    )
)

:: Run the script
echo All dependencies are installed. Running the script...
start /min python %SCRIPT_PATH%
if %errorlevel% neq 0 (
    echo An error occurred while running the script.
    pause
    exit /b 1
)

echo Script executed successfully.