安装PsrPopPy报no module named pep425tags如何修复
报错根因
pep425tags是wheel包0.34.2及更早版本内置的子模块,wheel 0.35及以上版本已经移除了该子模块,相关功能迁移到了独立的packaging库中,因此直接执行pip install pep425tags/pip install wheel.pep425tags找不到对应发行包。- PsrPopPy的构建配置文件
SConstruct写死了旧版wheel的模块导入路径,未适配新版wheel结构,触发导入报错。
可行解决方案
- 注意:如果你的Ubuntu 20.04环境中
python/pip默认指向Python2,请将后续命令中的pip替换为pip3、python替换为python3,避免依赖安装到错误的Python版本环境中。
方案一:安装兼容版本wheel(操作最简便)
- 卸载当前环境的新版wheel,安装保留了
pep425tags模块的指定旧版本:
pip uninstall -y wheel pip install wheel==0.34.2
- 安装项目构建所需的scons依赖:
pip install scons
- 回到PsrPopPy项目目录,重新执行安装流程:
cd ~/PsrPopPy python setup.py install
方案二:修改构建脚本适配新版wheel(无需降级wheel版本)
- 打开PsrPopPy根目录下的
SConstruct文件,定位到第19行的import wheel.pep425tags语句,将该行替换为以下兼容导入代码,自动适配新旧版本wheel:
try: from wheel import pep425tags except ImportError: from packaging import tags as pep425tags
- 保存文件修改后,确认已安装scons依赖,再执行
python setup.py install即可正常完成安装。
内容的提问来源于stack exchange,提问作者Julie J.
相关产品推荐
相关产品推荐

