导入matplotlib或scipy并使用pyinstaller 3.3编译的Anaconda python 2.7.14脚本失败并出现相同的错误: ImportError:没有名为_sysconfigdata的模块[54885]无法执行脚本pyi_rth_pkgres。
这些脚本在python环境中完美地执行,例如python myscript.py。运行可执行文件时,我得到了:
Traceback (most recent call last):
File "site-packages/PyInstaller/loader/rthooks/pyi_rth_pkgres.py", line 11, in <module>
File "lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 396, in load_module
File "site-packages/pkg_resources/__init__.py", line 1040, in <module>
File "site-packages/pkg_resources/__init__.py", line 1043, in Environment
File "site-packages/pkg_resources/__init__.py", line 272, in get_supported_platform
File "site-packages/pkg_resources/__init__.py", line 478, in get_build_platform
File "sysconfig.py", line 617, in get_platform
File "sysconfig.py", line 481, in get_config_vars
File "sysconfig.py", line 364, in _init_posix
ImportError: No module named _sysconfigdata
[54885] Failed to execute script pyi_rth_pkgres