Improve support for Python 2 and 3 on the same Windows machine

Idea created by slootsky on Oct 23, 2017
    • gratts
    • Hornbydd
    • tthayer
    • sebastienz
    • slootsky
    • APallentin

    With a standard install, when a user has both ArcGIS Desktop and ArcGISPro on their computer, there is no way to associate a .py file with the correct python interpreter because it could be either a python2 or a python3 script.


    The standard distribution of python3 for Windows includes a tool py.exe that allows developers to specify which version of python the script runs under by putting "#! python3" or "#! python2" on the first line of the script.  The py.exe is associated with .py files and then it calls the correct interpreter according to the first line of the script.


    The Python 3 distribution that comes with ArcGISPro does not include this py.exe executable, and additionally does not register PythonCore into HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE in a manner that would allow a downloaded py.exe to locate the Python 3 interpreter.


    If one or both of these items were implemented, it would make it easier for users to work with both Python 2 and Python 3 scripts on our machines:

    - distribute py.exe with ArcGISPro and configure it so it can call either Python2 or Python3

    - populate the HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore correctly so that a downloaded py.exe will work without additional configuration