Writing emacs commandsWindows Subsystem for Linux

OS X El Capitan, emacs and python

I recently wanted to write some Python code on my Macbook, but when starting the Python interpreter under emacs (25.2), I found the following warning generated:

  Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support
  readline, yet ‘python-shell-completion-native’ was t and "python" is not
  part of the ‘python-shell-completion-native-disabled-interpreters’ list.
  Native completions have been disabled locally.

Google led me to this bug report, with the following explanation/workaround for the issue:

This happens when python uses a libedit-based readline module, which is the default on macOS. This can be worked around by installing a GNU readline based module instead, for example, using setuptools:

  sudo easy_install gnureadline

And then rename the system's readline so that it won't be loaded:

  cd /System/Library/Frameworks/Python.framework/Versions/2.7/

The above rename won't work on later versions of MacOS, due to System Integrity Protection. This can be disabled by rebooting with cmd-R pressed, going to Utilities->Terminal and typing:

  csrutil disable

However, I'm not sure that the rename is required, as the install of gnureadline seems to ensure that the GNU version of the library is found first. Here's sys.path from the Mac, after the gnureadline install:

  [mark@aqua:/]$ python
  Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
  [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> print sys.path
Writing emacs commandsWindows Subsystem for Linux