ArcPy not recognized in Python Window inside ArcMap

Discussion created by kekenes on Jan 15, 2014
Latest reply on May 7, 2018 by k_doughty_ricondo
This has been a source of incredible frustration for me for the last couple of days. For some reason no IDEs nor ArcMap recognize arcpy. I've been learning Python through online tutorials over the last couple of weeks without issues. The scripts I wrote inside the Python window of ArcMap have worked just fine -- until a couple of days ago.

I recently began a tutorial that encouraged scripting in PythonWin. So I installed Python 2.6 and PythonWin on my machine. But for some reason PythonWin wouldn't open, so I installed Python 2.7. It opened, but when I attempted to import arcpy, I was given this error:

"ImportError: No module named arcpy"

The same error appeared in IDLE and PyScripter. So I reopened the Python Window in ArcMap and arcpy wasn't recognized there eighter! It printed this message:

"NameError: name 'arcpy' is not defined"

I'm also unable to write expressions in the calculator with Python because it doesn't recognize the code. Does anyone know how I can fix this? Your help is much appreciated.