setup.bat 896 B

123456789101112131415161718192021222324252627
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set PYTHON_URL=https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-amd64.zip
  4. set PIP_URL=https://bootstrap.pypa.io/get-pip.py
  5. set HF_ENDPOINT=https://hf-mirror.com
  6. set PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple
  7. if not exist pdf2zh_dist/python.exe (
  8. powershell -Command "& {Invoke-WebRequest -Uri !PYTHON_URL! -OutFile python.zip}"
  9. powershell -Command "& {Expand-Archive -Path python.zip -DestinationPath pdf2zh_dist -Force}"
  10. del python.zip
  11. echo import site >> pdf2zh_dist/python312._pth
  12. )
  13. cd pdf2zh_dist
  14. if not exist Scripts/pip.exe (
  15. powershell -Command "& {Invoke-WebRequest -Uri !PIP_URL! -OutFile get-pip.py}"
  16. python get-pip.py
  17. )
  18. path Scripts
  19. pip install --no-warn-script-location --upgrade setuptools -i !PIP_MIRROR!
  20. pip install --no-warn-script-location --upgrade pdf2zh -i !PIP_MIRROR!
  21. pdf2zh -i
  22. pause