"In Inferior Python mode, input is echoed".

Emacs 对官方的 Interpreter 的支持有问题,会把用户输入的指令重复显示一遍:

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs, os;__pyfile = codecs.open('''/var/folders/7f/s191h4q97p90374yw15ssrs00000gn/T/py4vosYw''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/7f/s191h4q97p90374yw15ssrs00000gn/T/py4vosYw''');exec(compile(__code, '''/var/folders/7f/s191h4q97p90374yw15ssrs00000gn/T/py4vosYw''', 'exec'));
python.el: native completion setup failed, <class 'Exception'>: libedit based readline is known not to work,
      see etc/PROBLEMS under "In Inferior Python mode, input is echoed".
>>> 1 + 2
1 + 2

/etc/PROBLEMS 给出了一个 Work-around,我还没试(折腾)过:

*** In Inferior Python mode, input is echoed and native completion doesn’t work. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753

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 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
mv readline.so readline.so.bak

See https://pypi.python.org/pypi/gnureadline for more details on installation.

偶然发现调整 comint-process-echoes 能解决打印命令的问题: