2.1
This commit is contained in:
39
1.py
39
1.py
@@ -1,2 +1,37 @@
|
||||
print("hello")
|
||||
print("leo")
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import cv2
|
||||
|
||||
# pip freeze > requirements.txt
|
||||
|
||||
|
||||
# pip install -r requirements.txt
|
||||
|
||||
|
||||
|
||||
# 创建日志目录(如果不存在)
|
||||
log_dir = Path("logs")
|
||||
log_dir.mkdir(exist_ok=True)
|
||||
|
||||
# 生成带时间戳的日志文件名
|
||||
log_filename = log_dir / f"app_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log"
|
||||
|
||||
# 配置日志系统
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, # 设置日志级别,可选:DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
format="%(asctime)s [%(levelname)s] %(message)s", # 日志格式
|
||||
handlers=[
|
||||
logging.FileHandler(log_filename, encoding='utf-8'), # 输出到文件
|
||||
logging.StreamHandler() # 同时输出到控制台
|
||||
]
|
||||
)
|
||||
|
||||
# 示例日志
|
||||
logging.debug("这是调试信息(不会显示,因为默认级别是 INFO)")
|
||||
logging.info("程序启动")
|
||||
logging.warning("警告:某个操作可能有风险")
|
||||
logging.error("错误:出现异常")
|
||||
logging.critical("严重错误:程序即将终止")
|
||||
|
||||
print(f"日志文件已创建:{log_filename}")
|
||||
|
||||
84
requirements.txt
Normal file
84
requirements.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
ace_tools==0.0
|
||||
altair==5.5.0
|
||||
appnope==0.1.4
|
||||
asttokens==3.0.0
|
||||
attrs==25.3.0
|
||||
blinker==1.9.0
|
||||
cachetools==5.5.2
|
||||
certifi==2025.4.26
|
||||
charset-normalizer==3.4.2
|
||||
click==8.2.0
|
||||
comm==0.2.2
|
||||
contourpy==1.3.1
|
||||
cramjam==2.11.0
|
||||
cycler==0.12.1
|
||||
debugpy==1.8.15
|
||||
decorator==5.2.1
|
||||
executing==2.2.0
|
||||
fastparquet==2024.11.0
|
||||
filelock==3.19.1
|
||||
fonttools==4.56.0
|
||||
fsspec==2025.9.0
|
||||
gitdb==4.0.12
|
||||
GitPython==3.1.44
|
||||
hf-xet==1.1.10
|
||||
huggingface-hub==0.35.3
|
||||
idna==3.10
|
||||
ipykernel==6.29.5
|
||||
ipython==9.4.0
|
||||
ipython_pygments_lexers==1.1.1
|
||||
jedi==0.19.2
|
||||
Jinja2==3.1.6
|
||||
joblib==1.5.2
|
||||
jsonschema==4.23.0
|
||||
jsonschema-specifications==2025.4.1
|
||||
jupyter_client==8.6.3
|
||||
jupyter_core==5.8.1
|
||||
kiwisolver==1.4.8
|
||||
MarkupSafe==3.0.2
|
||||
matplotlib==3.10.1
|
||||
matplotlib-inline==0.1.7
|
||||
mysql-connector-python==9.5.0
|
||||
narwhals==1.39.1
|
||||
nest-asyncio==1.6.0
|
||||
numpy==2.2.3
|
||||
packaging==24.2
|
||||
pandas==2.2.3
|
||||
parso==0.8.4
|
||||
pexpect==4.9.0
|
||||
pillow==11.1.0
|
||||
platformdirs==4.3.8
|
||||
plotly==6.1.0
|
||||
prompt_toolkit==3.0.51
|
||||
protobuf==6.31.0
|
||||
psutil==7.0.0
|
||||
ptyprocess==0.7.0
|
||||
pure_eval==0.2.3
|
||||
pyarrow==20.0.0
|
||||
pydeck==0.9.1
|
||||
Pygments==2.19.2
|
||||
pyparsing==3.2.3
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2025.1
|
||||
PyYAML==6.0.3
|
||||
pyzmq==27.0.0
|
||||
referencing==0.36.2
|
||||
requests==2.32.3
|
||||
rpds-py==0.25.0
|
||||
scikit-learn==1.7.1
|
||||
scipy==1.16.1
|
||||
seaborn==0.13.2
|
||||
six==1.17.0
|
||||
smmap==5.0.2
|
||||
stack-data==0.6.3
|
||||
streamlit==1.45.1
|
||||
tenacity==9.1.2
|
||||
threadpoolctl==3.6.0
|
||||
toml==0.10.2
|
||||
tornado==6.5
|
||||
tqdm==4.67.1
|
||||
traitlets==5.14.3
|
||||
typing_extensions==4.13.2
|
||||
tzdata==2025.1
|
||||
urllib3==2.4.0
|
||||
wcwidth==0.2.13
|
||||
Reference in New Issue
Block a user