title: Convert .py to .exe including matplotlib code
body: <p>I am trying to convert this code:</p>
  
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  import readTrc
  
  path = 'C:/filepath/data.trc'
  datX, datY, m = readTrc.readTrc(path)
  
  srx, sry = pd.Series(datX * 1000), pd.Series(datY * 1000)
  df = pd.concat([srx, sry], axis = 1)
  df.set_index(0, inplace = True)
  
  df.plot(grid = 1,
          linewidth = 0.5,
          figsize = (9,5),
          legend = False,
          xlim = (df.index[0] , df.index[-1]),
          xticks = [-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9])
  plt.xlabel('Zeit in ms')
  plt.ylabel('Spannung in mV')
  plt.savefig('test.png', dpi = 600)
  </code></pre>
  
  <p>into an executable with cx_Freeze. </p>
  
  <p>Setup.py :</p>
  
  <pre><code>import cx_Freeze
  import sys
  import matplotlib
  base = None
  if sys.platform == "win32":
      base = "Win32GUI"
  
  executables = [
      cx_Freeze.Executable("read_trc.py", base = base),
      ]
  
  build_exe_options = {"includes":["matplotlib.backends.backend_tkagg"],
                       "include_files":[(matplotlib.get_data_path(), "mpl-data"),
                                        ('C:/filepath', 'data.trc')],
                       "excludes":[],
                       }
  cx_Freeze.setup(
      name = "script",
      options = {"build_exe": build_exe_options},
      version = "0.0",
      description = "A basic example",
      executables = executables)
  </code></pre>
  
  <p>The conversion works but when I try to run the .exe I get this error:</p>
  
  <p><a href="https://i.stack.imgur.com/5fmez.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5fmez.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to make this work? I am using Python 3.6 on Windows 10.</p>
  
  <p>I have already tried the fixes found on Stackoverflow regarding Numpy import errors but it does not seem to help.</p>
  
  <p>Edit:
  Thanks to comments I solved the Error. Unfortunately now I get another Error when I try to execute the converted file:</p>
  
  <p><a href="https://i.stack.imgur.com/0Xnd3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Xnd3.png" alt="enter image description here"></a></p>
  
  <p>Edit2:</p>
  
  <p>I tried to include tkinter in my code but it doesn't work. I have a standard python 3.6 distribution installed which should include tkinter. tkinter.test() works. I assume that there is something wrong with the tkinter.ddls import. How would I do that correctly?</p>
  
  <pre><code>import cx_Freeze
  import sys
  import os
  import matplotlib
  
  os.environ['TCL_LIBRARY'] = r"C:\Users\Artur\AppData\Local\Programs\Python\Python36\DLLs\tcl86t.dll"
  os.environ['TK_LIBRARY'] = r"C:\Users\Artur\AppData\Local\Programs\Python\Python36\DLLs\tk86t.dll"
  
  base = None
  
  if sys.platform == "win32":
      base = "Win32GUI"
  
  executables = [
      cx_Freeze.Executable("plt_test.py", base = base),
      ]
  
  include_files = [(matplotlib.get_data_path(), "mpl-data"),
                   ('C:/Users/Artur/Desktop/Nellingen/Messdaten/20180104_Zyl_NiCr_DCneg_5bar_HSC/20180104_04_Zyl_NiCr_DCneg_5bar_170kV_HSC_Firefly/C220180104_ch2_UHF00000.trc',
                    'C220180104_ch2_UHF00000.trc'),
                   (r"C:\Users\Artur\AppData\Local\Programs\Python\Python36\DLLs\tcl86t.dll",
                   r"C:\Users\Artur\AppData\Local\Programs\Python\Python36\DLLs\tk86t.dll")]
  
  build_exe_options = {"includes":["matplotlib.backends.backend_tkagg"],
                       "include_files":include_files,
                       "excludes":[],
                       "packages":["numpy", "matplotlib", "pandas", 'tkinter', 'os'],
                       }
  cx_Freeze.setup(
      name = "script",
      options = {"build_exe": build_exe_options},
      version = "0.0",
      description = "A basic example",
      executables = executables)
  </code></pre>
  
  <p>Output in windows console:</p>
  
  <p><a href="https://i.stack.imgur.com/e6TsX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e6TsX.png" alt="enter image description here"></a></p>