Python部署遇wheel包未安装弃用错误,求版本指定方案
部署Python3.7.12时的弃用错误解决指导
问题描述
部署Python 3.7.12版本代码时遇到一系列弃用错误,已尝试在部署流程中安装wheel包但问题未解决,询问是否需要指定wheel包的特定版本并寻求相关指导。
错误日志
2022-11-14T19:34:39.7229174Z ##[error]Bash wrote one or more lines to the standard error stream. 2022-11-14T19:34:39.7241399Z ##[error] DEPRECATION: wrapt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 2022-11-14T19:34:39.7244863Z ##[error] DEPRECATION: keyless-fernet is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 2022-11-14T19:34:39.7247898Z ##[error] DEPRECATION: tornado is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 2022-11-14T19:34:39.7251293Z ##[error] DEPRECATION: pyrsistent is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 2022-11-14T19:34:39.7254435Z ##[error] DEPRECATION: Flask-JWT-Extended is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
解决建议
验证wheel的安装状态与环境匹配
部署流程中安装wheel后,可能因环境隔离(如虚拟环境未激活、pip路径不对应Python3.7)导致wheel未被当前pip调用。执行以下命令确认:pip --version # 确认当前pip关联的是Python3.7 pip list | grep wheel # 查看wheel是否已安装及具体版本指定兼容Python3.7的wheel版本
Python3.7已停止维护,wheel从0.39.0版本起不再支持Python3.7,需安装兼容的旧版本。在安装项目依赖前执行:pip install wheel==0.38.4启用PEP517安装模式
按照错误提示,在安装依赖时添加--use-pep517参数,强制pip使用PEP517规范的安装流程,避免legacy的setup.py方式:pip install --use-pep517 -r requirements.txt升级兼容的依赖包版本
部分旧版本依赖包缺少pyproject.toml配置,可尝试升级到支持PEP517且兼容Python3.7的版本:- wrapt:升级至>=1.14.0版本
- tornado:升级至>=6.2版本
内容的提问来源于stack exchange,提问作者Partha
相关产品推荐
相关产品推荐

