pyinstaller ImportError: The 'packaging' package is required; ...

来源:互联网 发布:php ob get contents 编辑:程序博客网 时间:2024/05/17 22:58

运行python2.6.6上使用pyinstaller打包的应用程序报错ImportError: The ‘packaging’ package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

问题描述

运行python2.6.6上使用pyinstaller打包的应用程序报下面的错误

Traceback (most recent call last):  File "<string>", line 11, in <module>  File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module    exec(bytecode, module.__diact__)  File "site-packages\pkg_resources\__init__.py", line 74, in <module>  File "site-packages\pkg_resources\extern\__init__.py", line 60, in load_moduleImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.pyi_rth_pkgres returned -1

解决办法

使用 pip list 查看已经安装的包,发现是setuptools包的版本太高,环境里的setuptools版本是20.x.x。

果断卸载并安装低版本的setuptools(19.2),如下:

pip uninstall setuptoolspip install setuptools==19.2

重新打包python脚本再运行,问题解决。

2 0
原创粉丝点击