Pyinstaller .exe compilation error

966 Views Asked by At

THE SOLUTION---> import Tkinter at top f script.

I am trying to compile my python script (which uses matplotlib, pyside.pyqt, and numpy) into an exe using PyInstaller. After I compile it using this command:

py PyInstaller.py guidraw_final.py

I go ahead and run it from the directory it gets put into. However, I get this following error, which I don't understand.

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'

Next error--->

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>

Thanks for any guidance given.

0

There are 0 best solutions below