According to the answer to question, I installed readline for python to resolve backspace issue. If I logged in CentOS 7 as a root, I can backspace without any problems;however, if I logged in as a user, I have to run pip install readline
to resolve backspace problem. I do not know where to set the readline so I do not need to reinstall it every time when I log in as a user. In my computer, it does not define "PYTHONSTARTUP" which is mentioned in one of solutions in question.
Any further help and suggestion would be highly appreciated.

- 93
- 1
- 8
-
Possible duoicate of [how-do-i-install-a-pip-package-globally-instead-of-locally](https://stackoverflow.com/questions/36936212/how-do-i-install-a-pip-package-globally-instead-of-locally) – ShpielMeister Jan 07 '18 at 05:43
-
No. My case is different from the one you gave. I did test the solutions given in the website. – Leon WANG Jan 07 '18 at 10:53
1 Answers
NOTE: My system is CentOS 7. Intel Python was installed. If you use different Python, please see corresponding websites.
After studying online, I installed anaconda2, and set ~/.bashrc:
module load anaconda/anaconda2
next, set ~/.pystartup (refer link)
import atexit import os,sys import readline import rlcompleter readline.parse_and_bind("tab: complete")
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath): import readline readline.write_history_file(historyPath)
if os.path.exists(historyPath): readline.read_history_file(historyPath)
atexit.register(save_history) del os, atexit, readline, rlcompleter, save_history, historyPath
In addition, my system is CentOS 7. The cluster is using intel compiler and Intel Python. Thus, if you are using Intel Python, please install anaconda3(may 2);else, please refer link.

- 93
- 1
- 8