Browse Source

add build

git@yoqi.me 8 months ago
parent
commit
b51d93929f
4 changed files with 56 additions and 3 deletions
  1. 1 0
      .gitignore
  2. 9 2
      README.md
  3. 44 0
      main.spec
  4. 2 1
      requirements.txt

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 *.pyc
 /data/
+build/

+ 9 - 2
README.md

@@ -5,8 +5,8 @@
 
 ```
 cd my_project_dir
-virtualenv -p /opt/python/bin/python3 venv
-source venv/bin/activate
+virtualenv -p /opt/python/3.8.5/bin/python3 .venv
+source .venv/bin/activate
 pip install -r requirements.txt
 
 # method 1
@@ -16,6 +16,13 @@ python main.py --start 20230822 --end 20230823
 python main.py
 ```
 
+Ubuntu 打包:
+```
+pip install pyinstaller
+pyinstaller -F -c main.py
+```
+
+
 ### 截图
 
 ![](screenshot/1.jpg)

+ 44 - 0
main.spec

@@ -0,0 +1,44 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+
+block_cipher = None
+
+
+a = Analysis(
+    ['main.py'],
+    pathex=[],
+    binaries=[],
+    datas=[],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    win_no_prefer_redirects=False,
+    win_private_assemblies=False,
+    cipher=block_cipher,
+    noarchive=False,
+)
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.zipfiles,
+    a.datas,
+    [],
+    name='main',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=True,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+)

+ 2 - 1
requirements.txt

@@ -1 +1,2 @@
-requests
+requests
+urllib3==1.26.6