Users are unable to import or load ArcPy in ArcMap with the installed version of Python.
Cause
There are several possible causes:
A problem occurred during the installation of Python while installing ArcGIS for Desktop.
The incorrect path to the default Python installation is being provided in the Windows Environment Variables.
An incorrect folder is used for the PythonWin installation (if applicable).
Note:
Users can install different versions or bit versions of Python. ArcMap requires Python 2.7.x (32-bit). For more information, refer to the following article, FAQ: What version of Python is used in ArcGIS?
Using a version of Python other than the version expected with ArcGIS can lead to compatibility issues.
Solution or Workaround
Use one or all of the following solutions to resolve this issue.
Under the System variables column, find the Path variable, select it, and click the Edit button.
In the Variable value text box, locate and remove any existing path(s) to any python.exe file(s). Remove only the text between the semicolons.
At the end of the Variable value text box, add a new semicolon and add the path to the Python.exe file installed by ArcGIS for Desktop, found here: C:\Python27\ArcGIS10.x
Click OK to save the changes.
Add the path needed by modifying the .pth file
Navigate to C:\Python27\ArcGIS10.x\Lib\site-packages.
Using a text editor, such as Notepad, open the Desktop10.x.pth file.
Verify the following lines are present in the text file:
Remove any ArcGIS10.x folders from the following directory: C:\Python27.
Repair ArcMap using one of the following steps:
Rerun the installation tool, and click the Repair radio button.
Navigate to the Control Panel > Programs > Programs and Features > Uninstall a program, and double-click ArcGIS for Desktop. Click the Repair radio button.
If using PythonWin: Without ArcMap, the default installation path for PythonWin is:
To ensure the correct default path is used during installation, uninstall PythonWin, follow Step 4 to repair ArcMap, and reinstall PythonWin.
Note:
If users have ArcGIS for Server installed on the same machine, a 64-bit Python is also installed. This leads to the script calling the wrong bit version of Python.
Users are unable to select the default installation path for PythonWin during installation. The steps to repair ArcMap are crucial to ensure the correct destination path.