Skip to content

Commit

Permalink
小修小改一下qaq
Browse files Browse the repository at this point in the history
  • Loading branch information
lmk123568 committed Aug 6, 2024
1 parent 516164f commit 552c7cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
本项目用 pyinstaller 打包

```bash
pyinstaller -F --additional-hooks-dir=./hooks -i "bilibili-line.png" run_main.py
pyinstaller -F --additional-hooks-dir=./hooks -i "bilibili.png" run_main.py
```

打包的关键点在于写好 hook,参考`./hooks/hook-streamlit.py`,将 streamlit 库以及 `main.py``bilibili.png` 等文件打包成单个 exe 文件
6 changes: 5 additions & 1 deletion hooks/hook-streamlit.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from PyInstaller.utils.hooks import copy_metadata
from PyInstaller.utils.hooks import collect_data_files


# import importlib
# print(importlib.util.find_spec("streamlit"))

datas = [
(
"C:\\Users\\24089\\miniconda3\\envs\\aaa\\Lib\\site-packages\\streamlit\\runtime",
"C:\\Users\\24089\\miniconda3\\Lib\\site-packages\\streamlit\\runtime",
"./streamlit/runtime",
)
]
Expand Down
2 changes: 0 additions & 2 deletions run_main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import streamlit

import streamlit.web.cli as stcli
import os, sys

Expand Down

0 comments on commit 552c7cd

Please sign in to comment.