I have created a python script (Parcel_Account_2.py), 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
error:

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 Parcel_Account_2.py 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 HelloWorld.py with one line below:
print "Hello World!"
Then created a setup.py as follows:
from distutils.core import setup
import py2exe
setup(console=['HelloWorld.py'])
Then ran the following command:
python setup.py py2exe
Then ran HelloWorld.exe
No problem. I got the correct output as Hello World!
However, when I added import arcpy into my HelloWorld.py, 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 (Parcel_Account_2.py) using py2exe?