我使用Windows 10 64位元(Anaconda ver 5.3)。
在我使用的以前版本的Anaconda中,pyinstaller成功地从我的代码创建了可执行文件,除非每次导入scipy.root(以及其他可能的scipy函数)。因此,我安装了最新版本的Anaconda(版本5.3)。而且情况变得更糟。即使是相对简单的代码,我也无法创建可执行文件。
我的pyinstaller可用于简单的“ hello world”程序。 当我尝试导入Matplotlib时,它失败了。因此,我从matplotlib中删除了所有内容。但仍然,我的代码失败了。这是DOS窗口中的日志(我完全没有这种解释的经验):
\Util\Work\Calibration\openCV\automatic_calibration\PyInstall>pyinstaller automatic_calibration.py automatic_calibration.spec --clean -p ..\..\..\..\Calibration\openCV\automatic_calibration -p ..\..\..\..\PythonLib -p ..\..\..\..\Measurements -p ..\..\..\..\Calibration\openCV --hidden-import FunctionsUtil --hidden-import VideoUtil_pyinst
78 INFO: PyInstaller: 3.4
78 INFO: Python: 3.7.0
78 INFO: Platform: Windows-10-10.0.17134-SP0
78 INFO: wrote C:\Util\Work\Calibration\openCV\automatic_calibration\PyInstall\automatic_calibration.spec
78 INFO: UPX is not available.
78 INFO: Removing temporary files and cleaning cache in C:\Users\michael.b\AppData\Roaming\pyinstaller
93 INFO: Extending PYTHONPATH with paths
['C:\\Util\\Work\\Calibration\\openCV\\automatic_calibration\\PyInstall',
'C:\\Util\\Work\\Calibration\\openCV\\automatic_calibration\\PyInstall',
'C:\\Util\\Work\\Calibration\\openCV\\automatic_calibration',
'C:\\Util\\Work\\PythonLib',
'C:\\Util\\Work\\Measurements',
'C:\\Util\\Work\\Calibration\\openCV',
'C:\\Util\\Work\\Calibration\\openCV\\automatic_calibration\\PyInstall']
93 INFO: checking Analysis
93 INFO: Building Analysis because Analysis-00.toc is non existent
93 INFO: Initializing module dependency graph...
109 INFO: Initializing module graph hooks...
109 INFO: Analyzing base_library.zip ...
4909 INFO: Analyzing hidden import 'FunctionsUtil'
6930 INFO: Processing pre-find module path hook distutils
7180 INFO: Processing pre-find module path hook site
7180 INFO: site: retargeting to fake-dir 'c:\\anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
9867 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
17090 INFO: Processing pre-safe import module hook six.moves
21574 INFO: Analyzing hidden import 'VideoUtil_pyinst'
34701 INFO: Processing pre-safe import module hook urllib3.packages.six.moves
53985 INFO: Processing pre-safe import module hook win32com
103134 INFO: running Analysis Analysis-00.toc
103150 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\anaconda3\python.exe
104071 INFO: Caching module hooks...
104087 INFO: Analyzing C:\Util\Work\Calibration\openCV\automatic_calibration\PyInstall\automatic_calibration.py
104484 INFO: Analyzing C:\Util\Work\Calibration\openCV\automatic_calibration\PyInstall\automatic_calibration.spec
104497 INFO: Loading module hooks...
104500 INFO: Loading module hook "hook-babel.py"...
104895 INFO: Loading module hook "hook-certifi.py"...
104903 INFO: Loading module hook "hook-Crypto.py"...
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'Crypto.Math'
105151 INFO: Loading module hook "hook-cryptography.py"...
105684 INFO: Loading module hook "hook-cv2.py"...
105684 INFO: Loading module hook "hook-distutils.py"...
105684 INFO: Loading module hook "hook-docutils.py"...
107215 INFO: Loading module hook "hook-encodings.py"...
107325 INFO: Loading module hook "hook-h5py.py"...
107325 INFO: Loading module hook "hook-imageio.py"...
107340 INFO: Loading module hook "hook-IPython.py"...
107356 INFO: Excluding import 'matplotlib'
107371 INFO: Removing import of matplotlib.pyplot from module IPython.core.pylabtools
107371 INFO: Removing import of matplotlib.figure from module IPython.core.pylabtools
107371 INFO: Removing import of matplotlib._pylab_helpers from module IPython.core.pylabtools
107371 INFO: Removing import of matplotlib from module IPython.core.pylabtools
107387 INFO: Excluding import 'PyQt4'
107387 INFO: Removing import of PyQt4 from module IPython.external.qt_loaders
107387 INFO: Excluding import 'PySide'
107403 INFO: Removing import of PySide from module IPython.external.qt_loaders
107403 INFO: Excluding import 'gtk'
107418 INFO: Excluding import 'PyQt5'
107418 INFO: Removing import of PyQt5.QtGui from module IPython.external.qt_loaders
107418 INFO: Removing import of PyQt5.QtCore from module IPython.external.qt_loaders
107418 INFO: Removing import of PyQt5.QtWidgets from module IPython.external.qt_loaders
107418 INFO: Removing import of PyQt5.QtSvg from module IPython.external.qt_loaders
107418 INFO: Removing import of PyQt5 from module IPython.external.qt_loaders
107418 INFO: Excluding import 'tkinter'
107434 INFO: Removing import of tkinter from module IPython.lib.clipboard
107434 INFO: Loading module hook "hook-jedi.py"...
107434 INFO: Loading module hook "hook-jinja2.py"...
107465 INFO: Loading module hook "hook-jsonschema.py"...
107465 INFO: Loading module hook "hook-lib2to3.py"...
107465 INFO: Loading module hook "hook-lxml.etree.py"...
107481 INFO: Loading module hook "hook-matplotlib.backends.py"...
108356 INFO: Matplotlib backend "GTK3Agg": ignored
cairo backend requires that cairocffi or pycairo is installed
108762 INFO: Matplotlib backend "GTK3Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
109324 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx' from 'matplotlib.backends' (c:\anaconda3\lib\site-packages\matplotlib\backends\__init__.py)
c:\anaconda3\lib\site-packages\IPython\kernel\__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
113042 INFO: Matplotlib backend "nbAgg": ignored
_cffi_ext.c
c:\anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(213): fatal error C1083: Cannot open include file: 'sys/un.h': No such file or directory
_cffi_ext.c
c:\anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(213): fatal error C1083: Cannot open include file: 'sys/un.h': No such file or directory
DLL load failed: The specified module could not be found.
113479 INFO: Matplotlib backend "Qt4Agg": ignored
Failed to import any qt binding
113905 INFO: Matplotlib backend "Qt4Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
114436 INFO: Matplotlib backend "Qt5Agg": ignored
Failed to import any qt binding
114987 INFO: Matplotlib backend "Qt5Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
115597 INFO: Matplotlib backend "TkAgg": added
116216 INFO: Matplotlib backend "TkCairo": ignored
cairo backend requires that cairocffi or pycairo is installed
116754 INFO: Matplotlib backend "WebAgg": added
117273 INFO: Matplotlib backend "WX": ignored
No module named 'wx'
117717 INFO: Matplotlib backend "WXAgg": ignored
No module named 'wx'
118120 INFO: Matplotlib backend "WXCairo": ignored
No module named 'wx'
118529 INFO: Matplotlib backend "agg": added
118936 INFO: Matplotlib backend "cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
119451 INFO: Matplotlib backend "pdf": added
119965 INFO: Matplotlib backend "pgf": added
120373 INFO: Matplotlib backend "ps": added
120777 INFO: Matplotlib backend "svg": added
121296 INFO: Matplotlib backend "template": added
121646 INFO: Loading module hook "hook-matplotlib.py"...
122030 INFO: Loading module hook "hook-numpy.core.py"...
122118 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
122126 INFO: Loading module hook "hook-numpy.py"...
122127 INFO: Loading module hook "hook-openpyxl.py"...
122141 INFO: Loading module hook "hook-pandas.py"...
123184 INFO: Loading module hook "hook-PIL.Image.py"...
123807 INFO: Loading module hook "hook-PIL.py"...
123814 INFO: Excluding import 'PyQt4'
123821 INFO: Removing import of PyQt4 from module PIL.ImageQt
123822 INFO: Excluding import 'PySide'
123831 INFO: Removing import of PySide from module PIL.ImageQt
123832 INFO: Excluding import 'PyQt5'
123839 INFO: Removing import of PyQt5.QtGui from module PIL.ImageQt
123839 INFO: Removing import of PyQt5.QtCore from module PIL.ImageQt
123840 INFO: Import to be excluded not found: 'FixTk'
123843 INFO: Excluding import 'tkinter'
123850 INFO: Removing import of tkinter from module PIL.ImageTk
123850 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
123858 INFO: Excluding import 'tkinter'
123866 INFO: Import to be excluded not found: 'FixTk'
123866 INFO: Loading module hook "hook-pkg_resources.py"...
125074 INFO: Loading module hook "hook-pycparser.py"...
125402 INFO: Loading module hook "hook-pydoc.py"...
125404 INFO: Loading module hook "hook-pygments.py"...
127386 INFO: Loading module hook "hook-PyQt5.py"...
127486 WARNING: Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding:
Traceback (most recent call last):
File "<string>", line 11, in <module>
ImportError: DLL load failed: The specified module could not be found.
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 17, in <module>
File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
self.__postinit__()
File "c:\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 500, in assemble
module_hook.post_graph()
File "c:\anaconda3\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "c:\anaconda3\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\anaconda3\lib\site-packages\PyInstaller\compat.py", line 736, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\anaconda3\lib\site-packages\PyInstaller\hooks\hook-PyQt5.py", line 23, in <module>
collect_system_data_files(pyqt5_library_info.location['PrefixPath'],
File "c:\anaconda3\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 67, in __getattr__
qli = json.loads(json_str)
File "c:\anaconda3\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "c:\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSON
DecodeError: Expecting value: line 1 column 1 (char 0)