Programing

ʻipython` 탭 자동 완성이 가져온 모듈에서 작동하지 않습니다.

lottogame 2020. 10. 22. 07:39
반응형

ʻipython` 탭 자동 완성이 가져온 모듈에서 작동하지 않습니다.


IPython에서 탭 완성이 작동하지 않는 것 같습니다. 예를 들면

import numpy
numpy.<tab>

단순히 탭을 추가합니다.

import numpy
num<tab>

탭도 추가합니다. 이 문제의 가능한 원인을 제안 해 주시겠습니까? Windows 7 및 Python 2.6.5를 실행하고 있습니다.


pyreadline 라이브러리를 설치했는지 확인하십시오 . 탭 완성 및 기타 IPython 기능에 필요합니다. Windows에서는 IPython 패키지와 함께 제공되지 않으며 별도로 설치해야합니다.

> pip install pyreadline

ipythonrc 파일이 오래되었을 수 있습니다. 달리기

ipython -upgrade

pip pyreadline 버전 1.7.1이 설치되어 있다고 말했습니다.

C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1

업그레이드 pyreadline하면 문제가 해결되었습니다.

C:\Users\me>pip install --upgrade pyreadline

C:\Users\me>pip freeze | grep readline
pyreadline==2.0

고전적인 '전원을 껐다가 다시 켜봤습니까?'가 저에게 효과적이었습니다.

pip uninstall ipython
pip install ipython

현재 OSX에서 pip가 설치된 ipython은 탭 완성을 제공하지 않으며 pyreadline release.py는 파열됩니다 .. what WFM :

easy_install ipython readline

YMMV.


StackOverflow의 다른 누군가가이 링크를 게시했습니다. http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/

기본적으로 easy_install readlinereadline 달걀이 설치된 위치를 발견하고이 readline을 사용하도록 ipython bin 스크립트를 편집하는 것입니다.

  1. "공식"readline을 설치하십시오 : easy_install readline
  2. 그것이 어디에 있는지 발견하십시오. /Library/Python/site-packages/readline-*.egg또는 VIRTUALENV 대응에
  3. ipython bin이 어디에 있는지 알아보십시오. which ipython
  4. 이 파일에 한 import sys줄을 추가하고 바로 뒤에 readline 달걀 경로를 추가하십시오 .

내 virtualenved ipython bin 스크립트가 다음과 같이 작동했습니다.

#!/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')()
    )

나는 이것이 정말로 오래된 질문이라는 것을 알고 있지만 위의 답변 중 어느 것도 저에게 효과가 없었습니다 (그리고 이것은 이러한 성격의 질문을 Google에서 얻을 때 얻는 첫 번째 히트입니다).

이것은 Windows에만 국한되지 않는다고 언급해야합니다. CentOS 6.5 및 Python 2.7을 실행하는 데 문제가있었습니다

내가 한 일은 다음과 같습니다.

apt-get/yum install ncurses-devel
#If you want history in iPython:
apt-get/yum install sqlite-devel
easy_install ipython readline
ipython

In [1]: from 
Display all 391 possibilities? (y or n)

-devel 패키지가없는 경우 링크하고 계란을 빌드 할 때 설치가 실패합니다. 다른 사람들에게 도움이되기를 바랍니다!


Pyreadline은 ipython에 필요합니다. pyreadline을 설치하십시오. 이것은 Windows 7에서 수행되었습니다. pyreadline zip, pyreadline-master.zip , 압축을 풉니 다. powershell에서 디렉토리를 uzipped pyreadline으로 변경하고 python이 Path에 설정되어 있는지 확인하고 명령을 입력합니다. python setup.py install그러면 C : \ Python27 \ Lib \ site-packages에 pyreadline이 설치됩니다.


I had this problem and knew that I had the pip installed for the module I was looking for. Performing $ ipython --init solved the problem for me.


I had to mv ~/.ipython{,.bak} in my case.


If you use Jupyter notebook and you still did get Tab auto-complete working after you tried all the steps suggested in the post here, you might want to check if you are trying to use the Tab auto-completion within a function definition. Ifyour import statements are part of the function such as below, you will not get the Tab auto-completion. You need to put the import statements outside the function and also execute them once before asking for auto-completion on the packages.

def myfunction():
    import pandas as pd
    import numpy as np

    a = pd.DataFrame(np.random.normal(1,3, (4,4))
    return a

Downgrading iPython did the trick.

pip install --upgrade ipython==5.8.0

참고URL : https://stackoverflow.com/questions/2603798/ipython-tab-autocomplete-does-not-work-on-imported-module

반응형