Python to exe: py2exe issues with pkg_resources
Question: I've built an application in Python that I'd like to distribute to my
enterprise and installing Python on each machine is unfortunately not an
option. I'd like to convert the application to an .exe so that users can run
my application with shortcut on their desktop.

This is my first attempt at distribution, so please forgive my lack of
knowledge on the subject. I'm having issues with py2exe when I attempt to
convert my .py script to a .exe.

My setup.py script looks like this:

    
    
    from distutils.core import setup
    import py2exe
    import numpy
    import matplotlib
    
    setup(console=['inpho.py'],
          data_files=matplotlib.get_py2exe_datafiles()
          )
    

After I run `python setup.py py2exe`, I get the expected `dist` and `build`
directories. However, if I run my application, now called `InPho.exe`, a cmd
window opens and I immediately get an error: `ImportError: No module named
pkg_resources`.

My first thought is that my setup.py script is wrong, I just do not know how
to properly write one. In my inpho.py script, I use import the following:

  * pandas
  * Tkinter
  * pyodbc
  * sqlalchemy
  * sqlite3
  * datetime
  * tkMessageBox
  * os
  * shutil

Any help is greatly appreciated!


Answer: Py2exe might not handle some of the dependencies out of the box. Try this
advice from the py2exe tutorial on how to handle import errors in this case:
[Dealing With
ImportError](http://www.py2exe.org/index.cgi/DealingWithImportError)

