pyinstaller和matplotlib - executiontring .exe时出错

时间:2016-08-19 12:18:04

标签: matplotlib pyinstaller

我在Python中构建一个创建条形图的简单程序。从进一步我想构建一个更复杂的版本,将在其他PC(没有安装python)中使用,我需要创建一个.exe。为了创建可执行文件,我使用了pyinstaller。 Pyinstaller似乎没有任何问题,并创建可执行文件。但是,当我运行它时,我收到以下错误:

Traceback (most recent call last):
File "PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\loader\pyimod03_importers.py", line   389, in load_module exec(bytecode, module.__dict__)
File "pkg_resources\__init__.py", line 68, in <module>
File "pkg_resources\extern\__init__.py", line 60, in load_module
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.Failed to execute script pyi_rth_pkgres

你们有任何想法如何解决它? 这里是源代码:

import matplotlib.pyplot as plt

A = [5., 30., 45., 22.]
B = [5., 25., 50., 20.]
X = range(4)
plt.bar(X, A, color = 'b')
plt.bar(X,B, color = 'r', bottom = A)
plt.show()

这里是pyinstaller的输出日志:

223 INFO: PyInstaller: 3.2
223 INFO: Python: 3.5.2
223 INFO: Platform: Windows-7-6.1.7601-SP1
226 INFO: wrote C:\Users\310251823\PycharmProjects\Prove1\Prova.spec
243 INFO: UPX is not available.
251 INFO: Extending PYTHONPATH with paths
['C:\\Users\\310251823\\PycharmProjects\\Prove1',
 'C:\\Users\\310251823\\PycharmProjects\\Prove1']
251 INFO: checking Analysis
252 INFO: Building Analysis because out00-Analysis.toc is non existent
252 INFO: Initializing module dependency graph...
255 INFO: Initializing module graph hooks...
256 INFO: Analyzing base_library.zip ...
4572 INFO: running Analysis out00-Analysis.toc
4646 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4652 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-heap-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4657 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-locale-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4689 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-math-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
4703 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-runtime-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5129 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-time-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5134 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-conio-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5160 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-string-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5169 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-process-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5186 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-convert-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5190 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-environment-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5203 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
5207 INFO: Caching module hooks...
5213 INFO: Analyzing C:\Users\310251823\PycharmProjects\Prove1\Prova.py
5471 INFO: Processing pre-find module path hook   distutils
10751 INFO: Processing pre-find module path hook   site
10752 INFO: site: retargeting to fake-dir 'C:\\Users\\310251823\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\pyinstaller-3.2-py3.5.egg\\PyInstaller\\fake-modules'
10772 INFO: Processing pre-safe import module hook   win32com
13072 INFO: Processing pre-safe import module hook   six.moves
28631 INFO: Loading module hooks...
28633 INFO: Loading module hook "hook-jinja2.py"...
28644 INFO: Loading module hook "hook-xml.dom.domreg.py"...
28647 INFO: Loading module hook "hook-_tkinter.py"...
28922 INFO: checking Tree
28922 INFO: Building Tree because out00-Tree.toc is non existent
28922 INFO: Building Tree out00-Tree.toc
28991 INFO: checking Tree
28991 INFO: Building Tree because out01-Tree.toc is non existent
28992 INFO: Building Tree out01-Tree.toc
29005 INFO: Loading module hook "hook-pythoncom.py"...
29569 INFO: Loading module hook "hook-sqlite3.py"...
29573 INFO: Loading module hook "hook-PyQt4.QtGui.py"...
30078 INFO: Loading module hook "hook-jsonschema.py"...
30082 INFO: Loading module hook "hook-win32com.py"...
30194 INFO: Loading module hook "hook-pydoc.py"...
30196 INFO: Loading module hook "hook-encodings.py"...
30205 INFO: Loading module hook "hook-setuptools.py"...
30207 INFO: Loading module hook "hook-requests.py"...
30212 INFO: Loading module hook "hook-matplotlib.py"...
30644 INFO: Loading module hook "hook-lib2to3.py"...
30647 INFO: Loading module hook "hook-matplotlib.backends.py"...
31457 INFO:   Matplotlib backend "GTK": ignored
    Gtk* backend requires pygtk to be installed.
32068 INFO:   Matplotlib backend "GTKAgg": ignored
    Gtk* backend requires pygtk to be installed.
32468 INFO:   Matplotlib backend "GTKCairo": ignored
    No module named 'gtk'
33046 INFO:   Matplotlib backend "MacOSX": ignored
    cannot import name '_macosx'
33684 INFO:   Matplotlib backend "Qt4Agg": added
34328 INFO:   Matplotlib backend "Qt5Agg": added
34923 INFO:   Matplotlib backend "TkAgg": added
35499 INFO:   Matplotlib backend "WX": ignored
    Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
36105 INFO:   Matplotlib backend "WXAgg": ignored
    Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
36529 INFO:   Matplotlib backend "GTK3Cairo": ignored
    Gtk3 backend requires pygobject to be installed.
37143 INFO:   Matplotlib backend "GTK3Agg": ignored
    Gtk3 backend requires pygobject to be installed.
38607 INFO:   Matplotlib backend "WebAgg": added
39577 INFO:   Matplotlib backend "nbAgg": added
40146 INFO:   Matplotlib backend "agg": added
40539 INFO:   Matplotlib backend "cairo": ignored
    Cairo backend requires that cairocffi or pycairo is installed.
40930 INFO:   Matplotlib backend "emf": ignored
    No module named 'matplotlib.backends.backend_emf'
41330 INFO:   Matplotlib backend "gdk": ignored
    No module named 'gobject'
41939 INFO:   Matplotlib backend "pdf": added
42663 INFO:   Matplotlib backend "pgf": added
43259 INFO:   Matplotlib backend "ps": added
44023 INFO:   Matplotlib backend "svg": added
44768 INFO:   Matplotlib backend "template": added
45009 INFO: Loading module hook "hook-pytz.py"...
45088 INFO: Loading module hook "hook-IPython.py"...
45101 INFO: Excluding import 'PySide'
45113 WARNING:   Removing import IPython.external.qt_loaders from module PySide.QtSvg
45113 WARNING:   Removing import IPython.external.qt_loaders from module PySide
45113 WARNING:   Removing import IPython.external.qt_loaders from module PySide.QtGui
45113 WARNING:   Removing import IPython.external.qt_loaders from module PySide.QtCore
45114 INFO: Excluding import 'PyQt4'
45124 WARNING:   Removing import IPython.external.qt_loaders from module PyQt4.QtCore
45124 WARNING:   Removing import IPython.external.qt_loaders from module PyQt4.QtSvg
45124 WARNING:   Removing import IPython.external.qt_loaders from module PyQt4
45141 WARNING:   Removing import IPython.external.qt_loaders from module PyQt4.QtGui
45144 INFO: Excluding import 'matplotlib'
45159 WARNING:   Removing import IPython.core.pylabtools from module matplotlib
45163 WARNING:   Removing import IPython.core.pylabtools from module matplotlib._pylab_helpers
45163 WARNING:   Removing import IPython.core.pylabtools from module matplotlib.rcParams
45164 WARNING:   Removing import IPython.core.pylabtools from module matplotlib.pylab
45164 WARNING:   Removing import IPython.core.pylabtools from module matplotlib.figure
45164 WARNING:   Removing import IPython.core.pylabtools from module matplotlib.pyplot
45164 WARNING:   Removing import IPython.core.pylabtools from module matplotlib.figure.Figure
45166 INFO: Excluding import 'gtk'
45175 WARNING:   Removing import IPython.lib.inputhook from module gtk
45175 WARNING:   Removing import IPython.lib.inputhookgtk from module gtk
45177 INFO: Excluding import 'tkinter'
45186 WARNING:   Removing import IPython.lib.inputhook from module tkinter
45189 WARNING:   Removing import IPython.lib.clipboard from module tkinter
45189 INFO: Excluding import 'PyQt5'
45200 WARNING:   Removing import IPython.external.qt_loaders from module PyQt5.QtGui
45202 WARNING:   Removing import IPython.external.qt_loaders from module PyQt5.QtCore
45202 WARNING:   Removing import IPython.external.qt_loaders from module PyQt5
45202 WARNING:   Removing import IPython.external.qt_loaders from module PyQt5.QtSvg
45202 WARNING:   Removing import IPython.external.qt_loaders from module PyQt5.QtWidgets
45203 INFO: Loading module hook "hook-pycparser.py"...
45358 INFO: Loading module hook "hook-pygments.py"...
46509 INFO: Loading module hook "hook-PIL.py"...
46514 INFO: Excluding import 'PyQt5'
46519 WARNING:   Removing import PIL.ImageQt from module PyQt5.QPixmap
46519 WARNING:   Removing import PIL.ImageQt from module PyQt5.qRgba
46519 WARNING:   Removing import PIL.ImageQt from module PyQt5.QImage
46521 WARNING:   Removing import PIL.ImageQt from module PyQt5
46521 INFO: Excluding import 'PySide'
46526 WARNING:   Removing import PIL.ImageQt from module PySide.QImage
46527 WARNING:   Removing import PIL.ImageQt from module PySide
46527 WARNING:   Removing import PIL.ImageQt from module PySide.QPixmap
46527 WARNING:   Removing import PIL.ImageQt from module PySide.qRgba
46528 INFO: Excluding import 'tkinter'
46532 INFO: Import to be excluded not found: 'FixTk'
46532 INFO: Excluding import 'PyQt4'
46539 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtCore
46539 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtCore.QBuffer
46539 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtGui.qRgba
46539 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtCore.QIODevice
46539 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtGui.QImage
46541 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtGui.QPixmap
46542 WARNING:   Removing import PIL.ImageQt from module PyQt4.QtGui
46544 INFO: Loading module hook "hook-PyQt4.QtCore.py"...
46643 INFO: Loading module hook "hook-zmq.py"...
47427 INFO: Excluding import 'zmq.libzmq'
47432 WARNING:   Removing import zmq from module zmq.libzmq
47433 INFO: Loading module hook "hook-PyQt4.QtSvg.py"...
47435 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
47436 INFO: Loading module hook "hook-distutils.py"...
47437 INFO: Loading module hook "hook-xml.py"...
47439 INFO: Loading module hook "hook-pkg_resources.py"...
47440 INFO: Loading module hook "hook-sysconfig.py"...
47442 INFO: Loading module hook "hook-PyQt4.py"...
47443 INFO: Loading module hook "hook-PIL.Image.py"...
47621 INFO: Loading module hook "hook-cryptography.py"...
47627 INFO: Loading module hook "hook-pywintypes.py"...
48177 INFO: Loading module hook "hook-shelve.py"...
48187 INFO: Loading module hook "hook-gevent.monkey.py"...
48192 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
48198 INFO: Excluding import 'tkinter'
48202 INFO: Import to be excluded not found: 'FixTk'
48350 INFO: checking Tree
48351 INFO: Building Tree because out02-Tree.toc is non existent
48351 INFO: Building Tree out02-Tree.toc
48581 INFO: checking Tree
48582 INFO: Building Tree because out03-Tree.toc is non existent
48582 INFO: Building Tree out03-Tree.toc
48585 INFO: Looking for ctypes DLLs
48657 INFO: Analyzing run-time hooks ...
48677 INFO: Including run-time hook 'pyi_rth_pkgres.py'
48680 INFO: Including run-time hook 'pyi_rth_traitlets.py'
48682 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
48687 INFO: Including run-time hook 'pyi_rth__tkinter.py'
48690 INFO: Including run-time hook 'pyi_rth_qt4plugins.py'
48693 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
48695 INFO: Including run-time hook 'pyi_rth_mpldata.py'
48742 INFO: Looking for dynamic libraries
65958 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\socket.cp35-win_amd64.p
yd
66065 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_device.cp35-win_amd64.
pyd
66161 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\error.cp35-win_amd64.py
d
66361 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\context.cp35-win_amd64.
pyd
66574 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_version.cp35-win_amd64
.pyd
66679 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\utils.cp35-win_amd64.py
d
66797 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\message.cp35-win_amd64.
pyd
66983 WARNING: lib not found: libzmq.cp35-win_amd64.pyd dependency of C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\zmq\backend\cython\_poll.cp35-win_amd64.py
d
75241 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-utility-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
76302 WARNING: Can not get binary dependencies for file: C:\Users\310251823\AppData\Local\Continuum\Anaconda3\api-ms-win-crt-multibyte-l1-1-0.dll
Traceback (most recent call last):
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
86495 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
86496 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_acd388d7e1d8689f.manifest
86726 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.6161_none ...
86726 INFO: Found manifest C:\windows\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251.manifest
86728 INFO: Searching for file msvcr90.dll
86728 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcr90.dll
86728 INFO: Searching for file msvcp90.dll
86729 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcp90.dll
86729 INFO: Searching for file msvcm90.dll
86729 INFO: Found file C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\msvcm90.dll
86947 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_acd19a1fe1da248a.manifest
86948 INFO: Found C:\windows\WinSxS\Manifests\amd64_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_acd388d7e1d8689f.manifest
86949 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 6161)
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtCore
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtSvg
92515 WARNING: Attempted to add Python module twice with different upper/lowercases: PyQt4.QtGui
92516 WARNING: Attempted to add Python module twice with different upper/lowercases: PIL._imaging
92516 WARNING: Attempted to add Python module twice with different upper/lowercases: PIL._imagingft
92516 INFO: Looking for eggs
92517 INFO: Using Python library C:\Users\310251823\AppData\Local\Continuum\Anaconda3\python35.dll
92517 INFO: Found binding redirects:
[BindingRedirect(name='Microsoft.VC90.CRT', language=None, arch='amd64', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 6161), publicKeyToken='1fc8b3b9a1e18e3b')]
92561 INFO: Warnings written to C:\Users\310251823\PycharmProjects\Prove1\build\Prova\warnProva.txt
92722 INFO: checking PYZ
92722 INFO: Building PYZ because out00-PYZ.toc is non existent
92722 INFO: Building PYZ (ZlibArchive) C:\Users\310251823\PycharmProjects\Prove1\build\Prova\out00-PYZ.pyz
96605 INFO: checking PKG
96605 INFO: Building PKG because out00-PKG.toc is non existent
96605 INFO: Building PKG (CArchive) out00-PKG.pkg
96703 INFO: Bootloader C:\Users\310251823\AppData\Local\Continuum\Anaconda3\lib\site-packages\pyinstaller-3.2-py3.5.egg\PyInstaller\bootloader\Windows-64bit\run.exe
96703 INFO: checking EXE
96703 INFO: Building EXE because out00-EXE.toc is non existent
96703 INFO: Building EXE from out00-EXE.toc
96703 INFO: Appending archive to EXE C:\Users\310251823\PycharmProjects\Prove1\build\Prova\Prova.exe
96733 INFO: checking COLLECT
96733 INFO: Building COLLECT because out00-COLLECT.toc is non existent
96733 INFO: Building COLLECT out00-COLLECT.toc

Here似乎与我的相似,但我不明白解决方案。如何导入&#39;包装&#39;打包到.spec文件?

谢谢你, SM

2 个答案:

答案 0 :(得分:0)

首先,我在pyinstaller日志中看到加载了PIL挂钩,excludes the tkinter module required by matplotlib。这是一个常见的问题,我也有,并且错误信息并不总是指向那个方向。

为了解决这个问题,我做了两件事。

  1. 在我的代码中使用import Tkinterimport FileDialog。最好在导入PIL
  2. 之后
  3. Download and install the latest development version of pyinstaller。 3.2仍然给我提出问题。
  4. 如果packaging错误仍然存​​在,您可以将其添加为hidden-import。在.spec文件中,这是Analysis的选项。

答案 1 :(得分:0)

在anaconda的情况下,setuptools的一部分pkg_resources._vendor.packaging丢失了。正如它所说,可能有必要联系分发包装商。

可以通过

安装pyinstaller的开发版本
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

version似乎与anaconda3一起使用,它甚至可以复制必要的dll依赖项。 tkinter.filedialog需要被指定为隐藏导入。

可以通过

安装更标准版本的setuptools
python -m pip install --upgrade --force-reinstall setuptools

我不知道这是否会导致anaconda出现问题。

我可以在安装另一个版本的setuptools之后构建脚本的可执行文件,将tkinter.filedialog添加为隐藏导入,并从 Anaconda3 / Library中复制 mkl _ * .dll 文件/ bin 文件夹。