AnsweredAssumed Answered

Cannot run my compiled Python exe file?

Question asked by SteveXu58 on Dec 30, 2015
Latest reply on Dec 31, 2015 by SteveXu58

I have created a python script (, which
is working.


Now, I used py2exe to create an exe file (Parcel_Account_2.exe), which is not working. The following screenshot is the


I’m using ArcGIS 10.2 with python 2.7.3(Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32). I think
the traceback information seems showing some arcpy files cannot be found. Unfortunately, I cannot fix the problem. Would you please help?


Originally, I sent this request to ESRI support, and told "Unfortunately, py2exe is not an Esri product and
is not supported by Esri.
".  I still wonder Why  the compiled exe couldn't only find those ESRI arcpy files? My python script also imports a third-party dll (cx_Oracle) which has been successfully pakaged into dist folder. Those arcpy files shown on the above screenshot can be found under C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy. I successfully compiled my by py2exe, but when I ran Parcel_Account_2.exe, and got the traceback importError in the screenshot. How to resolved the issue? Thanks a lot.


Message was edited by: Steve Xu I just did a test, which may give more information. My test is as follows: I created a simple python script named as with one line below: print "Hello World!" Then created a as follows: from distutils.core import setup import py2exe setup(console=['']) Then ran the following command: python py2exe Then ran HelloWorld.exe No problem. I got the correct output as Hello World! However, when I added import arcpy into my, re-ran all commands, I got the exact same traceback and ImportError message. How can I make the arcpy working by compiling my python script ( using py2exe?