cannot get pythonwin working with ArcGIS 10.6.1

1902
17
11-21-2019 11:29 AM
RickHawkins
New Contributor II

I am using ArcMap 10.6.1 and am trying to install and use pythonwin but i am not having much luck. What version of pythonwin should i be using and what version of python? When i try to enter import arcpy i get an error saying that module does not work. I am using pywin32-217.win32-py2.7.exe. 

If i did not provide enough information please let me know. I just started learning python scripting for ArcGIS

0 Kudos
17 Replies
DanPatterson_Retired
MVP Emeritus

You need the version for python 2.7.

You also have to use ArcMap's python interpreter... It sounds like you have a disconnect between the two

import sys
sys.executable

what does that report? and is it to the python that arcmp uses?

0 Kudos
RickHawkins
New Contributor II

when i enter the two commands into a pythonwin window i get nothing showing in the results section

0 Kudos
DanPatterson_Retired
MVP Emeritus

o you don't see something like this ?? (I can run pythonwin form ArcGIS pro, so the first part of the path isn't relevant... only the portion from … site-packages onwards is key

If memory serves, python for arcmap is installed in c:\python(version number etc)

0 Kudos
RickHawkins
New Contributor II

i get the following:  'C:\\Python27\\Lib\\site-packages\\pythonwin\\Pythonwin.exe'

0 Kudos
RickHawkins
New Contributor II

How do you use ArcMap's python interpreter? Right now i instatlled Python 2.7 and pywin 32 build 214. I tried the following code and get these errors. How do you get pythonwin to work with a current GIS document?

0 Kudos
DanPatterson_Retired
MVP Emeritus

I haven't used arcmap in ages, but if memory serves there should be a

C:\pythonxx\ folder on you computer followed by something like arcmapxx.

pythonwin has to be installed in the site-packages folder in that path.

I suspect that you might have more than one python 2.7... uninstall one of them would be my recommendation and use the python that is installed in the aforementioned path.

So crankup File Explorer and see if you can locate in the root directory of C or in C:\Program Files

0 Kudos
RickHawkins
New Contributor II

Dan, Sorry i am using ArcGIS Desktop 10.6.1.

Still learning

0 Kudos
DanPatterson_Retired
MVP Emeritus

we all are... let me know if you can't find the path to python which has the arcmap version number in it

0 Kudos
RickHawkins
New Contributor II

This is the path to python.exe is: C:\Python27\ArcGIS10.6

When i try to run the simple code shown above i get "no module named numpy". How do i get around this?

0 Kudos