Batch script that allows users to simply click an icon to run the NFL prediction app.
This script checks if Python is installed, installs required libraries if missing, and runs the script.
Code:
@echo off
REM Check if Python is installed
python --version >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Python is not installed. Please install Python from https://www.python.org/downloads/
pause
exit /b
)
REM Navigate to the directory of the Python script
cd /d "%~dp0"
REM Check if required libraries are installed and install them if necessary
pip show pandas >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Installing required library pandas...
pip install pandas
)
pip show numpy >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Installing required library numpy...
pip install numpy
)
pip show scikit-learn >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Installing required library scikit-learn...
pip install scikit-learn
)
REM Run the NFL prediction script
echo Running the NFL prediction code...
python nflweek2_live.py
pause
How to use the .bat file:
- Save the above script as a
.bat
file (e.g.,NFLPredictionApp.bat
). - Place the
.bat
file in the same folder as yournflweek2_live.py
Python script. - Double-click the
.bat
file to execute the Python script. The batch file will automatically check for Python installation and install any missing libraries before running the app.
Β