I am trying to set up Python so that I can execute ArcPy scripts outside of ArcMap. I'm new to Python, however I have previously been able to execute Pythons scripts from the cmd prompt (PowerShell), however I can't execute any ArcPy related scripts (maybe I'm misunderstanding).

First thing is that when I type "python" in the cmd, I am getting a different version to the one ArcMap 10.3 is using, which is 2.7.

enter image description here

I have set the path in Windows Environment Variable -

enter image description here

I'm using a textbook and seemed to have followed the instructions, so i'm not sure where I've gone wrong.

  • Have you tried using IDLE instead of command line? I think IDLE comes with the Arc install of Python 2.7, launching IDLE should link to the right Python installation
    – a11
    Nov 4 '19 at 21:39
  • I'm usingAtom to write the scripts - I dont think you can execute entire scripts within IDLE? Thanks.
    – edward29
    Nov 4 '19 at 21:59
  • does this help? youtube.com/watch?v=q0RSjeUaLcw see about 2 mins in
    – a11
    Nov 4 '19 at 22:14
  • @AlexS1 IDLE comes with it's own set of problems, I find PyWin much better, I would recommend the python window in ArcCatalog or ArcMap (you can even copy/paste multiple lines) to run test scripts. The problem here is that there are multiple installs of python but only one will work with arcpy. Have a read through gis.stackexchange.com/questions/268241/… and see if there's some helpful advice there. Nov 5 '19 at 2:07

You can execute your scripts by calling the python installation that comes with ArcGIS. In command prompt/powershell type (replace 'my_script.py' with your python script:

c:\python27\ArcGIS10.7\python.exe my_script.py

Check your path as it might be slightly different.

This will use the correct python version (2.7) and all the modules from ESRI will be available to import (arcpy is one of them).

If you just want to run python for testing in the terminal, open cmd/powershell and type:


Which will open the python prompt >>>

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.