title: Error while creating .exe using Pyinstaller
body: <p>I created simple HelloWorld program and tried to create .exe using PyInstaller
  .exe is created but doesnot run.</p>
  <p>Errors while Compiling</p>
  <pre><code>PS E:\Pot&gt; pyinstaller it.py
  62 INFO: PyInstaller: 3.6
  62 INFO: Python: 3.8.3
  62 INFO: Platform: Windows-10-10.0.18362-SP0
  62 INFO: wrote E:\Pot\it.spec
  62 INFO: UPX is not available.
  62 INFO: Extending PYTHONPATH with paths
  ['E:\\Pot', 'E:\\Pot']
  62 INFO: checking Analysis
  62 INFO: Building Analysis because Analysis-00.toc is non existent
  62 INFO: Initializing module dependency graph...
  62 INFO: Caching module graph hooks...
  78 INFO: Analyzing base_library.zip ...
  Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 41, in &lt;module&gt;
    File &quot;&lt;string&gt;&quot;, line 13, in walk_packages
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 130, in iter_modules
      for name, ispkg in iter_importer_modules(i, prefix):
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 149, in _iter_file_finder_modules
      import inspect
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py&quot;, line 40, in &lt;module&gt;
      import linecache
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py&quot;, line 11, in &lt;module&gt;
      import tokenize
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py&quot;, line 32, in &lt;module&gt;
      import re
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py&quot;, line 145, in &lt;module&gt;
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'
  Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 41, in &lt;module&gt;
    File &quot;&lt;string&gt;&quot;, line 13, in walk_packages
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 130, in iter_modules
      for name, ispkg in iter_importer_modules(i, prefix):
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 149, in _iter_file_finder_modules
      import inspect
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py&quot;, line 40, in &lt;module&gt;
      import linecache
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py&quot;, line 11, in &lt;module&gt;
      import tokenize
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py&quot;, line 32, in &lt;module&gt;
      import re
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py&quot;, line 145, in &lt;module&gt;
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'
  2514 INFO: Processing pre-find module path hook   distutils
  2514 INFO: distutils: retargeting to non-venv dir 'c:\\users\\paritosh malik\\appdata\\local\\programs\\python\\python38\\lib'
  3952 INFO: Caching module dependency graph...
  4014 INFO: running Analysis Analysis-00.toc
  4014 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
    required by c:\users\paritosh malik\appdata\local\programs\python\python38\python.exe
  4280 INFO: Analyzing E:\Pot\it.py
  4280 INFO: Processing module hooks...
  4280 INFO: Loading module hook &quot;hook-distutils.py&quot;...
  4295 INFO: Loading module hook &quot;hook-encodings.py&quot;...
  Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 41, in &lt;module&gt;
    File &quot;&lt;string&gt;&quot;, line 13, in walk_packages
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 130, in iter_modules
      for name, ispkg in iter_importer_modules(i, prefix):
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py&quot;, line 149, in _iter_file_finder_modules
      import inspect
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py&quot;, line 40, in &lt;module&gt;
      import linecache
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py&quot;, line 11, in &lt;module&gt;
      import tokenize
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py&quot;, line 32, in &lt;module&gt;
      import re
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py&quot;, line 145, in &lt;module&gt;
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'
  4389 INFO: Loading module hook &quot;hook-lib2to3.py&quot;...
  4389 INFO: Loading module hook &quot;hook-pydoc.py&quot;...
  4389 INFO: Loading module hook &quot;hook-sysconfig.py&quot;...
  4389 INFO: Loading module hook &quot;hook-xml.etree.cElementTree.py&quot;...
  4389 INFO: Loading module hook &quot;hook-xml.py&quot;...
  4436 INFO: Loading module hook &quot;hook-_tkinter.py&quot;...
  Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tkinter\__init__.py&quot;, line 39, in &lt;module&gt;
      import re
    File &quot;c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py&quot;, line 145, in &lt;module&gt;
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'
  4592 ERROR: Tcl/Tk improperly installed on this system.
  4608 INFO: Looking for ctypes DLLs
  4655 INFO: Analyzing run-time hooks ...
  4655 INFO: Including run-time hook 'pyi_rth__tkinter.py'
  4655 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
  4670 INFO: Looking for dynamic libraries
  4717 WARNING: lib not found: pywintypes38.dll dependency of c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\win32\win32evtlog.pyd
  4733 WARNING: lib not found: pywintypes38.dll dependency of c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\win32\win32api.pyd
  4889 INFO: Looking for eggs
  4889 INFO: Using Python library c:\users\paritosh malik\appdata\local\programs\python\python38\python38.dll
  4889 INFO: Found binding redirects:
  []
  4889 INFO: Warnings written to E:\Pot\build\it\warn-it.txt
  4936 INFO: Graph cross-reference written to E:\Pot\build\it\xref-it.html
  4951 INFO: checking PYZ
  4951 INFO: Building PYZ because PYZ-00.toc is non existent
  4951 INFO: Building PYZ (ZlibArchive) E:\Pot\build\it\PYZ-00.pyz
  5529 INFO: Building PYZ (ZlibArchive) E:\Pot\build\it\PYZ-00.pyz completed successfully.
  5545 INFO: checking PKG
  5545 INFO: Building PKG because PKG-00.toc is non existent
  5545 INFO: Building PKG (CArchive) PKG-00.pkg
  5561 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
  5561 INFO: Bootloader c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
  5561 INFO: checking EXE
  5561 INFO: Building EXE because EXE-00.toc is non existent
  5561 INFO: Building EXE from EXE-00.toc
  5576 INFO: Appending archive to EXE E:\Pot\build\it\it.exe
  5576 INFO: Building EXE from EXE-00.toc completed successfully.
  5576 INFO: checking COLLECT
  5576 INFO: Building COLLECT because COLLECT-00.toc is non existent
  5592 INFO: Building COLLECT COLLECT-00.toc
  5811 INFO: Building COLLECT COLLECT-00.toc completed successfully.
  </code></pre>
  <p>Error while running the .exe</p>
  <pre><code>PS E:\Pot&gt; dist\it\it
  Python path configuration:
    PYTHONHOME = 'E:\Pot\dist\it'
    PYTHONPATH = (not set)
    program name = 'E:\Pot\dist\it\it.exe'
    isolated = 0
    environment = 0
    user site = 0
    import site = 0
    sys._base_executable = 'E:\\Pot\\dist\\it\\it.exe'
    sys.base_prefix = ''
    sys.base_exec_prefix = ''
    sys.executable = 'E:\\Pot\\dist\\it\\it.exe'
    sys.prefix = ''
    sys.exec_prefix = ''
    sys.path = [
      'E:\\Pot\\dist\\it\\base_library.zip',
      'E:\\Pot\\dist\\it',
    ]
  Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  Python runtime state: core initialized
  LookupError: unknown encoding: utf-8
  
  Current thread 0x000046f8 (most recent call first):
  &lt;no Python frame&gt;
  PS E:\Pot&gt;
  </code></pre>
  <p>I tried adding &quot;utf_8.pyc&quot; into encodings folder in base_library.zip but then it shows some other error init_sys_streams
  So I think error is in lack of files in base_library.zip
  Please Help..
  Please Help..
  Please Help..
  Please Help..</p>