build.py 451 B

12345678910111213141516171819
  1. import site
  2. import os
  3. from PyInstaller.__main__ import run as pyi_run
  4. # the llama_cpp directory is not included if not explicitly added
  5. site_packages_dir = site.getsitepackages()[0]
  6. llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp")
  7. args = [
  8. "ollama.py",
  9. "--paths",
  10. site_packages_dir,
  11. "--add-data",
  12. f"{llama_cpp_dir}{os.pathsep}llama_cpp",
  13. "--onefile"
  14. ]
  15. # generate the .spec file and run PyInstaller
  16. pyi_run(args)