1

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
  • 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. – yanes Nov 3 '15 at 16:24
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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.