If you installed the student version of ArcGIS, you should already have Python on your computer, typically in a folder called something like C:\Python27\ArcGIS10.x\. You can write Python code at any time in Notepad or other editors and save it as a .py file, but you need to have Python installed in order for your computer to understand and run the program.
In this course, we’ll be working with Python version 2.7.x. If you check out the download page for Python from its home page at www.python.org (again, you won't have to download Python, just take a look!), you’ll see that there are actually higher versions of Python available. Python versions 3 and above contain some major changes that have taken some time for the Python user community and Esri to adopt.
Python comes with a simple default editor called IDLE; however, in this course, you’ll use the PythonWin integrated development environment (IDE) to help you write code. PythonWin is free, has basic debugging capabilities, and is included on the ArcGIS DVD. We here will download and install the newest version of PythonWin from the PythonWin GitHub repository at https://github.com/mhammond/pywin32/releases. It is important that you use use the "win32" version for Python 2.7 not the "amd64" executables which are for installing the 64-bit version of PythonWin, which is only compatible with ArcGIS for Server, not ArcGIS for Desktop. Please follow the instructions below:
- Download the PythonWin installation file from this link: https://github.com/mhammond/pywin32/releases/download/b223/pywin32-223.win32-py2.7.exe
- Start the install by launching the downloaded file pywin32-2xx.win32-py2.7.exe . (If you are using Windows Vista or Windows 7, right-click this file and choose Run as Administrator and, when prompted, choose to Allow it to run.)
- Click Next through the wizard to install PythonWin.
- PythonWin doesn't put a Windows shortcut anywhere, so you get to make one yourself. Once the install completes, use My Computer (or "Computer") to browse to the location where you installed PythonWin. It's probably in C:\Python27\ArcGIS10.x\Lib\site-packages\pythonwin.
- Right-click the item PythonWin.exe and click Create Shortcut. You should see a Windows shortcut appear immediately below the PythonWin item.
- Drag and drop the shortcut onto your Desktop or wherever else you want to put it.
On Windows Vista or Windows 7, if you see error messages during install, it’s likely that you did not run the install as an Administrator. When you launch the install, make sure you right-click and choose Run as Administrator.