2

I have ArcGIS 10.0 And installed pythonwin 2.6.5

When wrote a script in Python Shell - it works just fine But in pythonwin - i get import arcpy error as below

>>> import arcpy
Traceback (most recent call last):
 File "<interactive input>", line 1, in <module>
ImportError: No module named arcpy
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 3, 2015 at 16:17
1
  • 1
    It looks like pythonwin cannot find the Arcpy module. Did you check if the path to arcpy is specified in pythonwin? I had a similar problem with anaconda and it was fixed by adding a path to arcpy. Commented Nov 3, 2015 at 16:24

1 Answer 1

5

You need to make sure pythonwin knows where the ArcGIS python packages reside. A simple way to do this would be to create a text file called arcgis.pth (or anything you want with ".pth" as the extension) in the Lib\site-packages directory of your pythonwin installation. The contents of the file should be these 3 lines (modified as needed to reflect the paths of your ArcGIS installation):

C:\Program Files (x86)\ArcGIS\Desktop10.0\bin
C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Scripts

Once that file is in place, pythonwin should be able to access arcpy successfully.

(Note that I wrote this based on my own ArcGIS 10.2 installation. I believe the directory structure was the same for 10.0, but if anybody can confirm this, that would be helpful.)

answered Nov 3, 2015 at 16:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.