Ok, so this answer works for the Anaconda 64bit Python distribution with ArcGIS 10.1 64bit on Windows 7/Windows Server.
Some of (or all) of the tips given below may apply to any other windows distribution of python.
First, install anaconda, it should go to the directory C:\Anaconda. Check the box 'make system default python'. It may give a warning that there is another python installed, but continue. Then:
Setup Paths and Environment Variables
First thing to do is to copy over the DTBGGP64.pth file to the new distribution directory (C:\Anaconda) from C:\Python27\ArcGISx6410.1\Lib\site-packages.
The naming is arbritrary, but must have the .pth extension
This will allow you to import ArcPy when using the new distribution.
Note: The correct location of the DTBGGP64.pth file should be in the site-packages directory (e.g. C:\Anaconda\Libs\site-packages). I have found that with some older versions of Anaconda, it works if sat in the top level directory
Next, the environment variables must be checked:
In the system variable Path, the existing path to the python directory should be replaced with the new path. (e.g. C:\Anaconda;C:\Anaconda\Scripts;)
This will tell windows where the default python directory is.
Make sure the user variable PYTHONPATH is also correct. This should point to any libraries you wish to use which are not described by .pth files or are installed in site-packages. I.E this might be your own development packages, or packages such as mapnik which have a different installation location.
Check Registry Settings
On some machines, the above may be enough to ensure that you can use arcpy from the new python and that python can be used within ArcGIS.
On other machines, you may need to check registry keys.
The following registry keys have python settings:
There should be one key and its’ value should be C:\Anaconda\Lib;C:\Anaconda\DLLs
(Or the corresponding folders for your python installation)
The key should be C:\Anaconda
You may have other python versions installed...in which case change the version number in the above paths
This is the location of the .ico file to use for .pyc files
This is the command to issue when opening a .pyc file from the shell.
You should change the
python.exe path to the location of your desired python version
The keys here are the same as those for Python.CompiledFile except that they apply to a .py file. Again, make the relevant changes.
It may have an extra key for 'Edit with IDLE' or 'Edit with Pythonwin'. Again, make the relevant changes so that the paths in these keys point to your desired python version.
These are the same as for Python.File, but should point to the
pythonw.exe program where appropriate.
The PythonDir key points to the python installation to use within ArcMap etc..
You may wish for this to remain as the python installation as installed by ESRI, or point it to your new installation. It may require other changes if you point ArcMap to the new python installation. There may be issues with the versions of packages (e.g. numpy) installed by the new distribution. I have not encountered any.
For the majority of my work, this is irrelevant as I typically want to use python on it's own and occasionally have access to arcpy. I rarely wish to use python from within arcmap..Therefore I have done little testing of this final step, but it seems to work for everything I have tried so far.
I imagine that the process would be similar for installing Python(x,y) etc.
The contents of the .pth file is a list of paths pointing to the following folders in your ArcGIS installation:
bin64, arcpy, ArcToolbox\Scripts
For example, my .pth file contains the following:
C:\Program Files (x86)\ArcGIS\Desktop10.2\bin64
C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts