How can I get tab-completion in the interactive Python interpreter?bashrc or bash_profile?What's the best way...
Cayley's Matrix Notation
Retract an already submitted recommendation letter (written for an undergrad student)
Creating a chemical industry from a medieval tech level without petroleum
Is there any pythonic way to find average of specific tuple elements in array?
Is there metaphorical meaning of "aus der Haft entlassen"?
A strange hotel
Why do real positive eigenvalues result in an unstable system? What about eigenvalues between 0 and 1? or 1?
How can I get rid of an unhelpful parallel branch when unpivoting a single row?
Can a Bard use the Spell Glyph option of the Glyph of Warding spell and cast a known spell into the glyph?
How to have a sharp product image?
Can a stored procedure reference the database in which it is stored?
What *exactly* is electrical current, voltage, and resistance?
Prove that the countable union of countable sets is also countable
What is the unit of time_lock_delta in LND?
What does "function" actually mean in music?
Where was the County of Thurn und Taxis located?
As an international instructor, should I openly talk about my accent?
Why do games have consumables?
How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?
How much cash can I safely carry into the USA and avoid civil forfeiture?
How to not starve gigantic beasts
Philosophical question on logistic regression: why isn't the optimal threshold value trained?
Multiple options vs single option UI
Nails holding drywall
How can I get tab-completion in the interactive Python interpreter?
bashrc or bash_profile?What's the best way to get Python 2.5 and 2.7How to install a different version of python-dev?Command completion in R and pythonPython interactive interpreter: initial tab is 4, subsequent tabs are 8 spacesjumping cursor when using python interpreter in terminalProblem importing a module (mpl_toolkits.basemap) in PythonAdding git repositories to python 3 interpreterTab-completion of shell patternsPython 2 interpreter instead of 3 in GeanyHow to set Python3 as default Python interpreter for VScode?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
command-line programming python
add a comment |
I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
command-line programming python
add a comment |
I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
command-line programming python
I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
command-line programming python
command-line programming python
edited Feb 10 '11 at 9:41
Stefano Palazzo
asked Feb 10 '11 at 9:36
Stefano Palazzo♦Stefano Palazzo
64.2k34184216
64.2k34184216
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
First, create a new file called .pythonstartup.py
in your home directory. Put the following script in it:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in $PYTHONSTARTUP
, if there is one. To set it to execute the above script, type
export PYTHONSTARTUP="~/.pythonstartup.py"
You should write this line to your .bashrc
or .bash_profile
file, so that it's automatically executed when a new shell is started.
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path likeexport PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
Your can make the export a bit more tolerant by having exportPYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.python -i main.py
. Any way to do that?
– Chris Anderson
Apr 8 '17 at 16:27
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f25605%2fhow-can-i-get-tab-completion-in-the-interactive-python-interpreter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
First, create a new file called .pythonstartup.py
in your home directory. Put the following script in it:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in $PYTHONSTARTUP
, if there is one. To set it to execute the above script, type
export PYTHONSTARTUP="~/.pythonstartup.py"
You should write this line to your .bashrc
or .bash_profile
file, so that it's automatically executed when a new shell is started.
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path likeexport PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
Your can make the export a bit more tolerant by having exportPYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.python -i main.py
. Any way to do that?
– Chris Anderson
Apr 8 '17 at 16:27
add a comment |
First, create a new file called .pythonstartup.py
in your home directory. Put the following script in it:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in $PYTHONSTARTUP
, if there is one. To set it to execute the above script, type
export PYTHONSTARTUP="~/.pythonstartup.py"
You should write this line to your .bashrc
or .bash_profile
file, so that it's automatically executed when a new shell is started.
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path likeexport PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
Your can make the export a bit more tolerant by having exportPYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.python -i main.py
. Any way to do that?
– Chris Anderson
Apr 8 '17 at 16:27
add a comment |
First, create a new file called .pythonstartup.py
in your home directory. Put the following script in it:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in $PYTHONSTARTUP
, if there is one. To set it to execute the above script, type
export PYTHONSTARTUP="~/.pythonstartup.py"
You should write this line to your .bashrc
or .bash_profile
file, so that it's automatically executed when a new shell is started.
First, create a new file called .pythonstartup.py
in your home directory. Put the following script in it:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in $PYTHONSTARTUP
, if there is one. To set it to execute the above script, type
export PYTHONSTARTUP="~/.pythonstartup.py"
You should write this line to your .bashrc
or .bash_profile
file, so that it's automatically executed when a new shell is started.
edited 14 hours ago
answered Feb 10 '11 at 9:41
Stefano Palazzo♦Stefano Palazzo
64.2k34184216
64.2k34184216
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path likeexport PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
Your can make the export a bit more tolerant by having exportPYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.python -i main.py
. Any way to do that?
– Chris Anderson
Apr 8 '17 at 16:27
add a comment |
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path likeexport PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
Your can make the export a bit more tolerant by having exportPYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.python -i main.py
. Any way to do that?
– Chris Anderson
Apr 8 '17 at 16:27
6
6
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path like
export PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
NOTICE: This won't work if you start the terminal and then change directory. If you want this method to work no matter the directory you are, you should use the full path like
export PYTHONSTARTUP="/home/user/.pythonstartup.py"
– Pithikos
Oct 15 '14 at 14:58
1
1
Your can make the export a bit more tolerant by having export
PYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
Your can make the export a bit more tolerant by having export
PYTHONSTARTUP=~/.pythonstartup.py
– Mikael Fremling
Jan 26 '16 at 13:50
This doesn't work if you start a file in interactive mode, e.g.
python -i main.py
. Any way to do that?– Chris Anderson
Apr 8 '17 at 16:27
This doesn't work if you start a file in interactive mode, e.g.
python -i main.py
. Any way to do that?– Chris Anderson
Apr 8 '17 at 16:27
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f25605%2fhow-can-i-get-tab-completion-in-the-interactive-python-interpreter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown