Python3.7版本安装pyinstaller一直失败解决!无论是直接pip install pyinstaller还是指定pyinstaller各种版本安装,又或者pycharm进行安装也是失败,再就是重装PIP,还把pyinstaller的wheel文件下载到本地进行安装,总之试了各种方法都无效,折腾了好久。

pip install pyinstaller报错如下:

error: subprocess-exited-with-error

AttributeError: type object 'Distribution' has no attribute '_finalize_feature_opts'

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

解决思路如下:更新 setuptools 版本,先卸载setuptools再重新安装

pip uninstall setuptools
pip install setuptools

发现重装后的setuptools版本是有变化的,版本比之前的要低了。

然后再尝试安装pyinstaller:pip install pyinstaller

依旧报错,但是报错信息变了:

error: subprocess-exited-with-error

error: invalid command 'egg_info'

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output.

主要报错是由于:error: invalid command 'egg_info'

于是尝试继续更新setuptools:pip install --upgrade pip setuptools

从44.1.1更新到了65.7.0,发现版本又回到了刚开始的版本,相当于重新卸载再安装一遍!

再尝试进行pyinstaller安装吧:pip install pyinstaller

神奇,竟然成功了!

然后查询下pyinstaller的版本,发现是最新版本的pyinstaller。

总结:搞了半天,一直error: subprocess-exited-with-error,AttributeError: type object 'Distribution' has no attribute '_finalize_feature_opts'报错安装不上pyinstaller,

最终卸载重装了setuptools完美解决!!!

解决办法的指令如下:

1.pip uninstall setuptools

2.pip install setuptools

3.pip install --upgrade pip setuptools

4.pip install pyinstaller

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐