fix(build_exe.bat): 修复 PyInstaller 打包脚本——补充缺失依赖和调整配置
1. 补充 25+ 个 hidden-import(打包后运行崩溃的根因): plotly/pybaselines/scipy子模块/molmass/openpyxl/pyproj/jinja2/ requests/urllib3/certifi/geopandas/shapely/fiona/simplekml/joblib/ skgstat.DirectionalVariogram/tqdm 等 2. 补充 --add-data 文件(运行时 FileNotFound 的根因): mass_balance_template.html / gasflux.ini / gasflux.ini.example 3. 修复 python 命令兼容性:改为 py -3(适配 Windows Store Python) 4. 修正端口号提示:5000 → 5001(与 gasflux.ini 一致)
This commit is contained in:
@ -5,19 +5,19 @@ REM This script builds a standalone executable using Waitress WSGI server
|
||||
echo Building GasFlux Web API executable...
|
||||
|
||||
REM Check if PyInstaller is installed
|
||||
python -c "import PyInstaller" >nul 2>&1
|
||||
py -3 -c "import PyInstaller" >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Error: PyInstaller is not installed. Please run:
|
||||
echo pip install pyinstaller waitress
|
||||
echo py -3 -m pip install pyinstaller waitress
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Check if Waitress is installed
|
||||
python -c "import waitress" >nul 2>&1
|
||||
py -3 -c "import waitress" >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Error: Waitress is not installed. Please run:
|
||||
echo pip install waitress
|
||||
echo py -3 -m pip install waitress
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
@ -41,8 +41,24 @@ pyinstaller --onefile ^
|
||||
--hidden-import skgstat ^
|
||||
--hidden-import skgstat.Variogram ^
|
||||
--hidden-import skgstat.OrdinaryKriging ^
|
||||
--add-data "src\gasflux\gasflux_config.yaml;src\gasflux" ^
|
||||
--add-data "API_DOCUMENTATION.md;." ^
|
||||
--hidden-import skgstat.DirectionalVariogram ^
|
||||
--hidden-import plotly ^
|
||||
--hidden-import plotly.graph_objects ^
|
||||
--hidden-import plotly.express ^
|
||||
--hidden-import plotly.subplots ^
|
||||
--hidden-import pybaselines ^
|
||||
--hidden-import scipy ^
|
||||
--hidden-import scipy.odr ^
|
||||
--hidden-import scipy.signal ^
|
||||
--hidden-import scipy.stats ^
|
||||
--hidden-import scipy.integrate ^
|
||||
--hidden-import scipy.optimize ^
|
||||
--hidden-import molmass ^
|
||||
--hidden-import openpyxl ^
|
||||
--hidden-import pyproj ^
|
||||
--hidden-import jinja2 ^
|
||||
--hidden-import requests ^
|
||||
--hidden-import urllib3 ^
|
||||
--hidden-import matplotlib ^
|
||||
--hidden-import matplotlib.pyplot ^
|
||||
--hidden-import matplotlib.backends ^
|
||||
@ -53,7 +69,19 @@ pyinstaller --onefile ^
|
||||
--hidden-import matplotlib.patches ^
|
||||
--hidden-import matplotlib.text ^
|
||||
--hidden-import matplotlib.transforms ^
|
||||
--hidden-import tqdm ^
|
||||
--hidden-import certifi ^
|
||||
--hidden-import charset_normalizer ^
|
||||
--hidden-import geopandas ^
|
||||
--hidden-import shapely ^
|
||||
--hidden-import fiona ^
|
||||
--hidden-import simplekml ^
|
||||
--hidden-import joblib ^
|
||||
--exclude-module tkinter ^
|
||||
--add-data "src\gasflux\gasflux_config.yaml;src\gasflux" ^
|
||||
--add-data "src\gasflux\templates\mass_balance_template.html;src\gasflux\templates" ^
|
||||
--add-data "gasflux.ini;." ^
|
||||
--add-data "gasflux.ini.example;." ^
|
||||
server_waitress.py
|
||||
|
||||
if errorlevel 1 (
|
||||
@ -67,8 +95,10 @@ echo Build completed successfully!
|
||||
echo Executable created: dist\GasFluxAPI.exe
|
||||
echo.
|
||||
echo To run the server:
|
||||
echo GasFluxAPI.exe
|
||||
echo GasFluxAPI.exe
|
||||
echo.
|
||||
echo The server will start on http://localhost:5000
|
||||
echo The server will start on http://localhost:5001
|
||||
echo Make sure gasflux.ini is in the same directory as the executable,
|
||||
echo or configure paths via environment variables.
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user