diff --git a/PYTHON_3_10_COMPATIBILITY.md b/PYTHON_3_10_COMPATIBILITY.md index 4efeda6..f20a1ea 100644 --- a/PYTHON_3_10_COMPATIBILITY.md +++ b/PYTHON_3_10_COMPATIBILITY.md @@ -30,6 +30,15 @@ from pysnmp.hlapi.asyncio import bulkCmd, getCmd, nextCmd ``` +#### pyasn1 版本冲突解决 +**问题**:`pyasn1>=0.5.0` 移除了 `pyasn1.compat.octets` 模块,导致 pysnmp 导入失败。 +同时 `python-jose==3.5.0` 强制要求 `pyasn1>=0.5.0`,形成版本冲突。 + +**解决方案**: +- `pyasn1==0.4.8` - 锁定到包含 compat.octets 的版本 +- `pyasn1-modules==0.2.8` - 配套版本 +- `python-jose[cryptography]==3.3.0` - 兼容 pyasn1 0.4.8 的版本 + ### 依赖版本要求 - `pysnmp-lextudio==5.0.31` - SNMP 协议兼容替代 - `typing-extensions>=4.5.0` - 提供额外的类型支持 diff --git a/backend/requirements.txt b/backend/requirements.txt index f0fd02a..1dbb442 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -13,11 +13,15 @@ alembic==1.13.1 # 注意: pysnmp 7.x 与 Python 3.10+/asyncio 存在兼容性问题 # 使用 lextudio 维护的分支(向后兼容,支持 Python 3.6+) pysnmp-lextudio==5.0.31 +# pyasn1 0.5.0+ 移除了 compat.octets 模块,与 pysnmp 不兼容 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 scapy==2.5.0 python-dotenv==1.0.1 passlib[bcrypt]==1.7.4 httpx==0.27.0 -python-jose[cryptography] +# python-jose 3.5.0 需要 pyasn1>=0.5.0,与 pysnmp 冲突 +python-jose[cryptography]==3.3.0 bcrypt==3.2.2 # typing-extensions 提供 Python 3.10+ 的向后兼容支持 typing-extensions>=4.5.0