Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the Python interpreter welcome message be suppressed?

Tags:

python

Instead of:

$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

I'd like, for example:

$ python --quiet
>>>
like image 814
dpj Avatar asked Aug 03 '13 22:08

dpj


People also ask

How does the Python interpreter work?

The Python interpreter is a virtual machine, meaning that it is software that emulates a physical computer. This particular virtual machine is a stack machine: it manipulates several stacks to perform its operations (as contrasted with a register machine, which writes to and reads from particular memory locations).

What is invoking interpreter in Python?

Invoking the Interpreter. The Python interpreter is usually installed as /usr/local/bin/python3.10 on those machines where it is available; putting /usr/local/bin in your Unix shell's search path makes it possible to start it by typing the command: python3.10. to the shell.

What are two ways to run a program using the Python interpreter?

There are two ways to use the python interpreter: interactive mode and script mode.

How do I change Python interpreter?

Change the Python interpreter in the project settingsPress Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. Expand the list of the available interpreters and click the Show All link. Select the target interpreter.


2 Answers

You can try this:

$ python -ic ""
>>> 
like image 75
arshajii Avatar answered Oct 26 '22 10:10

arshajii


I have a startup file, so this works for me:

python -i "$PYTHONSTARTUP"

Although Python 3 now has a -q flag:

python3 -q
like image 42
wjandrea Avatar answered Oct 26 '22 09:10

wjandrea