Commit e0fedc66 by imwangxiaozhou

build: 添加依赖并改进 SQLite 兼容性

- 在 requirements.txt 中添加 cryptography、pydantic 和 pysqlite3-binary 依赖
- 修改 sync_data.py 和 search_merchants.py,使其在标准 sqlite3 模块不可用时自动回退到 pysqlite3-binary,以解决某些 Linux 环境下缺少 _sqlite3 模块的问题
1 parent d10c220c
pymysql
cryptography
schedule
fastapi
pydantic
uvicorn
# 用于解决 Linux 环境下 Python 缺少 _sqlite3 模块的问题
pysqlite3-binary
import sqlite3
try:
import sqlite3
except ImportError:
# 兼容某些 Linux 环境下 Python 缺少 _sqlite3 模块的问题
try:
from pysqlite3 import dbapi2 as sqlite3
except ImportError:
raise ImportError("系统缺少 sqlite3 且未安装 pysqlite3-binary。请运行: pip3 install pysqlite3-binary")
import os
import argparse
import json
......
import pymysql
import sqlite3
try:
import sqlite3
except ImportError:
# 兼容某些 Linux 环境下 Python 缺少 _sqlite3 模块的问题
try:
from pysqlite3 import dbapi2 as sqlite3
except ImportError:
raise ImportError("系统缺少 sqlite3 且未安装 pysqlite3-binary。请运行: pip3 install pysqlite3-binary")
import os
import schedule
import time
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!