Yum installs ReadLine, Readline-devel
#yum install-y Readline-devel
Download and install Setuptools
#wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5= 7df2a529a074f613b509fb44feefe74e--no-check-certificate
#tar-ZXVF setuptools-0.6c11.tar.gz
#cd SETUPTOOLS-0.6C11
#python setup.py Install
Download and install ReadLine
#wget https://pypi.python.org/packages/source/r/readline/readline-6.2.4.1.tar.gz#md5= 578237939c81fdbc2c8334d168b17907--no-check-certificate
#tar-ZXVF readline-6.2.4.1.tar.gz
#cd readline-6.2.4.1
#python setup.py Install
# python
Python 2.7.5 (Default, Sep 27 2014, 17:30:23)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import ReadLine
Switch to the Python directory, my system is/usr/local/python27/lib/python2.7
Edit tab.py Script
#!/usr/bin/env pythonimport sysimport readlineimport rlcompleterimport atexitimport os# tab Completionreadline.parse_and_bind ('tab:complete'= Os.path.join ( os.environ['HOME'. Pythonhistory')
Authorized
#chmod 755/usr/local/python27/lib/python2.7/tab.py
Modify the. bashrc file for the root directory
Add the following line
Export pythonstartup=/usr/local/python27/lib/python2.7/tab.py
Reload Environment variables
#source. BASHRC
And then go into the Python editor and you'll be able to complete it automatically.
This article is from the "Jeff" blog, so be sure to keep this source http://zhangxz.blog.51cto.com/5490116/1559297
python2.7 after installation, the import ReadLine importerror:no module named ReadLine and tab completion appear when Python is executed