Skip to content

Commit bd77558

Browse files
committed
init
0 parents  commit bd77558

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
# 最终生成的可执行文件
3+
dist
4+
# 临时编译文件,无需发布
5+
build

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# PythonDemo
2+
3+
## 编译
4+
5+
环境检查
6+
7+
```bash
8+
>python --version
9+
Python 3.12.7
10+
11+
>pip --version
12+
pip 25.0.1 from G:\xxx\Anaconda\Lib\site-packages\pip (python 3.12)
13+
14+
>conda --version
15+
conda 24.9.2
16+
```
17+
18+
依赖
19+
20+
```bash
21+
# 如果项目有.venv就用这个
22+
.\.venv\Scripts\activate
23+
24+
# 如果项目没有.venv就用这个
25+
python -m venv .venv
26+
.\.venv\Scripts\activate
27+
pip install -r .\requirements.txt # pip freeze > requirements.txt
28+
```
29+
30+
编译/运行
31+
32+
```bash
33+
# 运行
34+
python main.py
35+
36+
# 可执行文件
37+
pyinstaller --onefile main.py
38+
```

main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
@app.route('/')
6+
def hello():
7+
return "Hello World! This is a simple HTTP response."
8+
9+
if __name__ == '__main__':
10+
app.run(host='0.0.0.0', port=24006)

main.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['main.py'],
6+
pathex=[],
7+
binaries=[],
8+
datas=[],
9+
hiddenimports=[],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='main',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=True,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

requirements.txt

572 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)