Python 选项卡完成在交互式控制台中不起作用Ubuntu 20.04

问题描述

在我的 ts | text -----------------------------+------------------+ 2021-04-15T18:35:08.000000Z | wa-event-triggered <- start timer 2021-04-15T18:45:08.000000Z | wa-event-triggered 2021-04-15T18:55:08.000000Z | wa-event-triggered 2021-04-15T18:50:08.000000Z | wa-event-recovered <- end timer 2021-04-15T19:00:00.000000Z | wa-event-triggered <- start timer 2021-04-15T19:05:08.000000Z | wa-event-triggered 2021-04-15T19:10:08.000000Z | wa-event-triggered 2021-04-15T19:15:08.000000Z | wa-event-recovered <- end timer 2021-04-15T20:05:08.000000Z | wa-event-triggered <- start timer 2021-04-15T20:10:08.000000Z | wa-event-triggered 2021-04-15T20:15:08.000000Z | wa-event-recovered <- end timer 中,我有以下行来设置 ~/.bashrc 环境变量:

PYTHONSTARTUP

~/.pythonrc.py 的内容

export PYTHONSTARTUP=~/.pythonrc.py

刚运行时

try: import readline except ImportError: print("Module readline not available.") else: print("TAB-COMPLETE LOADED.") import rlcompleter readline.parse_and_bind("tab: complete")

在终端中打印消息“TAB-COMPLETE LOADED”并且标签完成按预期在变量上工作,但是通过运行以下文件

python3

它不起作用。不会打印预期的消息,它只是在按 Tab 键时插入一个制表符。无论变量是在控制台还是文件中声明,它的行为都是相同的。

example.py:

python3 example.py

我不明白为什么我的 test_variable = 123 import code; code.interact(local=dict(globals(),**locals())) 会被加载到前者而不是后者。一些帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)