0

我正在使用InteractiveShellEmbedfromIPython.terminal.embed在我的应用程序中嵌入 IPython。一切正常,但自动完成不适用于模块。例如:import rand[TAB]未完成到import random. 我能做些什么来解决这个问题?

我的代码:

# -*- coding: utf-8 -*-
#!/usr/bin/env python

def main():

    from IPython.terminal.embed import InteractiveShellEmbed

    ipshell = InteractiveShellEmbed(banner1 = 'Loading\n',
                                    exit_msg = 'Leaving')


    ipshell('Hit Ctrl-D to exit interpreter.\n')

if __name__ == "__main__":
    main()
4

1 回答 1

0

对于带有 python 2.7.6 的 iPython 5.1.0,自动完成功能似乎对我有用。您使用的是哪个版本的 iPython?如果您只使用“from IPython import embed”然后在您想要的应用程序中调用“embed()”,您是否有同样的问题?

- -更新:

尝试制作一个显式实例:

ipshell = InteractiveShellEmbed.instance()

于 2016-12-12T19:08:33.873 回答