30 lines
619 B
Batchfile
30 lines
619 B
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
|
|
REM 获取脚本所在目录
|
|
setlocal
|
|
set scriptdir=%~dp0
|
|
cd /d "%scriptdir%"
|
|
|
|
echo 正在安装依赖...
|
|
if exist requirements.txt (
|
|
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
|
|
) else (
|
|
echo 错误:未找到requirements.txt文件
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo 正在打包程序...
|
|
pip install pyinstaller
|
|
if exist main.py (
|
|
pyinstaller --onefile --windowed --hidden-import=pkg_resources.py2_warn main.py
|
|
echo 打包完成!可执行文件在dist目录下
|
|
) else (
|
|
echo 错误:未找到main.py文件
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
pause
|