I installed ArcMap 10.3.1 on a Windows 10 computer (using Python2.7.8) and arcpy imports properly in ArcMap and the Python IDLE but gets hung up when using command line. When importing, the cursor flashes like it's working but nothing ever happens. I have made sure the System properties reflect the path to the python folder and that the Desktop10.3.pth is correct. Any suggestions are appreciated.
Compare the sys.path you are getting from IDLE from the one you get from the command line. That may help you figure out what's going on.
import sys print(sys.version) # active version of python print(sys.prefix) # python exec path print("\n".join(sys.path)) # current path setting used by import
When running in Command Line vs. IDLE the only difference in the two print statements is IDLE prints C:\windows\SYSTEM32 and C:\Python27\ArcGIS10.3\Lib\idleLib while command line does not have those lines. I tried adding C:\Python27\ArcGIS10.3\Lib\idleLib to the PTH in my system environment variables but it didn't seem to change anything.
Here is what the IDLE print statements look like.
2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
C:\Program Files (x86)\ArcGIS\Desktop10.3\bin
C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy
C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcToolBox\Scripts
That is strange. Two more thoughts, don't know if they are worth much...
I have to run ArcGIS 10.3.1 in compatibility mode for it to run properly but I haven't had any issues with ArcGIS 10.3.1.
I am using the python that is installed with ArcGIS (Python 2.7.8) and I actually uninstalled the python 3.4 that also came with the ArcGIS installation in the event that is was causing confusion.
Python 3.4.x comes with ArcGIS PRO and both python 2.7.x and python 3.4.x live quite happily in either ArcMap 10.3.1/10.4 or ArcGIS Pro 1.1/1.2. The import thing, other that messing around with other distributions etc, is when what was installed and how you manage them. In a simple world, ArcWhatever would be installed and install whatever version of python it needs. When things go weird is when things don't follow the expected order of progression from an Arc* perspective.
I'm running ArcGIS Desktop 10.3.1 on Windows 10.0.10586 (this is the November 2015 stable build i believe). I don't have any trouble running ArcGIS or ArcPY or need to do anything special ie compatibility mode for either.
Do you get the same result with both the 32bit and 64bit version of python?
It does seem like something is a little off with the whole install. I'd probably uninstall ArcGIS Desktop, verify everything is removed from the "c:\Program Files (x86)\ArcGIS\Desktop10.3" folder and remove/delete the entire python C:\Python27 directory... just to make sure something older artifact is not lingering. Then reinstall ArcGIS Dekstop.