Python 3.x 如何在Python3.7shell提示符上获取与RHEL相同的已执行命令历史记录

Python 3.x 如何在Python3.7shell提示符上获取与RHEL相同的已执行命令历史记录,python-3.x,Python 3.x,我想知道如何在python3.x中获得执行命令/代码的历史记录,就像我们在RHEL-8中获得历史记录一样 尝试在>>>(python 3.x shell)提示符下执行历史记录命令和打印(历史记录),但出现错误 Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license

我想知道如何在python3.x中获得执行命令/代码的历史记录,就像我们在RHEL-8中获得历史记录一样

尝试在>>>(python 3.x shell)提示符下执行历史记录命令和打印(历史记录),但出现错误

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> history
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    history
NameError: name 'history' is not defined
>>> 
>>> print(history)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print(history)
NameError: name 'history' is not defined
>>> 
win32上的Python 3.7.4(tags/v3.7.4:e09359112e,2019年7月8日,20:34:20)[MSC v.1916 64位(AMD64)] 有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证()。 >>>历史 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 历史 NameError:未定义名称“历史记录” >>> >>>印刷品(历史) 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 印刷品(历史) NameError:未定义名称“历史记录” >>>
Getting Down错误的可能重复:-win32上的Python 3.7.4(标记/v3.7.4:e09359112e,2019年7月8日,20:34:20)[MSC v.1916 64位(AMD64)]键入“帮助”、“版权”、“信用”或“许可证()”,了解更多信息。>>readline.get_current_history_length()回溯(最近一次调用):文件“”,readline中的第1行。get_current_history_length()名称错误:名称“readline”未定义>>
pip install readline
(或
pip install pyreadline
,如果您在Windows上)。可能重复以下错误:-Python 3.7.4(tags/v3.7.4:e0935912e,2019年7月8日,20:34:20)[MSC v.1916 64位(AMD64)],在win32上键入“帮助”、“版权”、“信用”或“许可证()”以了解更多信息。>>>readline.get_current_history_length()回溯(最近一次调用):文件“”,第1行,在readline.get_current_history__length()中)名称错误:未定义名称“readline”>>
pip安装readline
(或
pip安装readline
,如果您在Windows上)。