Use Python to debug simple programs directly from the command line.
WIN10 (PowerShell) Without tab completion, the operation is really troublesome.
Online search learned, record, review with, hahaha
Environment: WIN10 64-bit Python2,python3One: Install the Pyreadline module
Pip Install Pyreadline # python2pip3 install Pyreadline # Python3
Ii. Preparation of tab.py
File saved in: \python2\lib\tab.py
例如:D:\Program Files\Python2\Lib\tab.py
python2 python3要使用TAb自动补全都要在对应的lib中建立tab.py文件
#python tabimport sys import readline import rlcompleter import atexit import os readline.parse_ And_bind (' Tab:complete ') # windowshistfile = Os.path.join (os.environ[' HomePath '], '. Pythonhistory ') # Linux # histfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ') try: readline.read_history_file (Histfile) except IOError: pass atexit.register (Readline.write_history_file, Histfile) del os, Histfile, ReadLine, Rlcompleter
Third, the effect test
Use Import tab to introduce tab completion
# Python2
# Python3
# After testing found that Python2 need to import tab to support auto-completion, and then python3 do not need to import tab to support auto-completion, do not know that is not my more special??
Win10 (PowerShell) Python Command line tab completion