`ipython` tab autocomplete does not work on imported module

后端 未结 14 1876
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 21:10

Tab completion on IPython seems not to be working. For example,

import numpy
numpy.

simply adds a tab.

import nu         


        
14条回答
  •  一个人的身影
    2020-11-29 21:34

    Someone else in StackOverflow posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/

    Its basicly easy_install readline than discover where the readline egg got installed and edit the ipython bin script to use this readline:

    1. Install the "official" readline: easy_install readline
    2. Discover where it is. Look at /Library/Python/site-packages/readline-*.egg or in your Virtualenv counterpart
    3. Discover where ipython bin is: which ipython
    4. Add ONE LINE to this file, adding the readline egg path right after import sys line.

    My virtualenved ipython bin script got working as follow:

    #!/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/bin/python
    # EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.13.1','console_scripts','ipython'
    __requires__ = 'ipython==0.13.1'
    import sys
    
    ### ONLY LINE ADDED:
    sys.path.insert(0, '/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/lib/python2.6/site-packages/readline-6.2.4.1-py2.6-macosx-10.6-fat.egg')
    ####
    
    from pkg_resources import load_entry_point
    
    if __name__ == '__main__':
        sys.exit(
            load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
        )
    

提交回复
热议问题