升级Python 3.11报错:找不到GLIBC_2.28版本如何解决?
解决Python 3.11/3.10中
GLIBC_2.28' not found的问题 问题根源:高版本cryptography依赖GLIBC 2.28+,即使直接移除cryptography,项目中其他依赖包可能间接引入了它;Python 3.9正常是因为当时安装的cryptography版本较低,不要求高版本GLIBC。
以下是可行的解决办法:
指定兼容低GLIBC的cryptography版本
查找适配当前系统GLIBC的版本(比如cryptography<38.0.0的版本大多支持GLIBC 2.17+),执行安装命令:pip install cryptography==37.0.4同时把版本号写入
requirements.txt:cryptography==37.0.4安装静态编译的预编译包
选择基于manylinux2014或更早标准编译的包,这类包不依赖系统高版本GLIBC:pip install cryptography --only-binary :all: --platform manylinux2014_x86_64注意根据你的系统架构调整
manylinux2014_x86_64(比如arm架构用manylinux2014_aarch64)。排查并替换间接依赖
用pip show <你的包名>检查项目中哪些包间接依赖了高版本cryptography,要么降级该包到不依赖高版本cryptography的版本,要么替换为功能类似的替代包。从源码本地编译cryptography
先安装编译依赖:# CentOS/RHEL系统 yum install gcc python3-devel openssl-devel # Debian/Ubuntu系统 apt-get install gcc python3-dev libssl-dev然后从源码编译安装,适配当前系统的GLIBC:
pip install cryptography --no-binary :all:
内容的提问来源于stack exchange,提问作者Rbadiger
相关产品推荐
相关产品推荐

