Pyinstaller .exe编译错误

时间:2015-06-17 02:37:03

标签: python numpy matplotlib pyinstaller

解决方案--->在顶部f脚本导入Tkinter。

我正在尝试使用PyInstaller将我的python脚本(使用matplotlib,pyside.pyqt和numpy)编译成exe。我使用此命令编译后:

py PyInstaller.py guidraw_final.py

我继续从它放入的目录中运行它。但是,我得到以下错误,我不明白。

PS C:\Users\Matthew\Desktop\pyinstaller-python3\guidraw_final\dist\guidraw_final> ./guidraw_final.exe
Qt: Untested Windows version 6.3 detected!
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\site-packages\matplotlib\pyplot.py", line 109, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Python34\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 6, in <module>
    from six.moves import tkinter as Tk
  File "C:\Python34\lib\site-packages\six.py", line 90, in __get__
    result = self._resolve()
  File "C:\Python34\lib\site-packages\six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "C:\Python34\lib\site-packages\six.py", line 80, in _import_module
    __import__(name)
ImportError: No module named 'tkinter'

下一个错误---&gt;

PS C:\Users\Matthew\Desktop\pyinstaller-python3\guidraw_final\dist\guidraw_final> ./guidraw_final
Qt: Untested Windows version 6.3 detected!
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\site-packages\matplotlib\pyplot.py", line 109, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Python34\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 6, in <module>
    from six.moves import tkinter as Tk
  File "<frozen importlib._bootstrap>", line 2281, in _handle_fromlist
  File "C:\Python34\lib\site-packages\six.py", line 90, in __get__
    result = self._resolve()
  File "C:\Python34\lib\site-packages\six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "C:\Python34\lib\site-packages\six.py", line 80, in _import_module
    __import__(name)
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\tkinter\__init__.py", line 36, in <module>
    from tkinter import _fix
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 308, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\lib\tkinter\_fix.py", line 65, in <module>
    import _tkinter
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "C:\Users\Matthew\Desktop\pyinstaller-python3\PyInstaller\loader\pyi_importers.py", line 478, in load_module
    module = loader.load_module(fullname)
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
PS C:\Users\Matthew\Desktop\pyinstaller-python3\guidraw_final\dist\guidraw_final>

感谢您给出的任何指导。

0 个答案:

没有答案