Files
Document_translator_V2_nodo…/setup_venv.bat
beabigegg 4cace93934 NO docker
2025-10-02 18:50:53 +08:00

54 lines
1.3 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
REM ============================================
REM PANJIT Document Translator V2
REM 虛擬環境建立腳本 (Windows)
REM ============================================
echo ========================================
echo PANJIT Document Translator V2
echo 建立 Python 虛擬環境
echo ========================================
echo.
REM 檢查 Python 是否存在
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [錯誤] 找不到 Python請先安裝 Python 3.8 或以上版本
echo 下載位置: https://www.python.org/downloads/
pause
exit /b 1
)
echo [1/3] 檢查 Python 版本...
python --version
echo.
echo [2/3] 建立虛擬環境 venv...
if exist venv (
echo [警告] 虛擬環境已存在,是否要刪除重建? (Y/N)
set /p confirm=
if /i "%confirm%"=="Y" (
echo [INFO] 刪除舊的虛擬環境...
rmdir /s /q venv
python -m venv venv
) else (
echo [INFO] 保留現有虛擬環境
)
) else (
python -m venv venv
)
echo.
echo [3/3] 啟動虛擬環境並升級 pip...
call venv\Scripts\activate.bat
python -m pip install --upgrade pip
echo.
echo ========================================
echo 虛擬環境建立完成!
echo ========================================
echo.
echo 下一步: 執行 install_python_dependencies.bat 安裝依賴套件
echo.
pause