Install Python and IDLE on Amazon AWS Linux

$ which python
/usr/bin/python

$ python --version
Python 2.7.16

$ yum info python3
$ yum info 'python3*'

$ sudo yum update
$ sudo yum install python3

$ yum list installed 'python3*'
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
python3.x86_64                        3.7.4-1.amzn2.0.4              @amzn2-core
python3-libs.x86_64                   3.7.4-1.amzn2.0.4              @amzn2-core
python3-pip.noarch                    9.0.3-1.amzn2.0.2              @amzn2-core
python3-setuptools.noarch             38.4.0-3.amzn2.0.6             @amzn2-core

pget shellscript

#!/usr/bin/bash
#This shellscript is pget.  Sample use:
#pget flag
#to download and run
#https://raw.githubusercontent.com/MarkMeretzky/Python-INFO1-CE9990/master/flag.py

if [[ $# -ne 1 ]]
then
        echo $0: needs exactly one argument 1>&2
        exit 1
fi

cd ~/bin

if [[ -e $1.py ]]
then
        echo -n "~/bin/$1.py already exists.  Remove?  [y/n]: "
        read answer
        if [[ $answer == 'y' ]]   #string comparison, not numeric comparison
        then
                rm $1.py
        else                      #anything other than y counts as no
                exit 1
        fi
fi

echo '#!/usr/bin/python3' > $1.py

if ! wget -q -O - https://raw.githubusercontent.com/MarkMeretzky/Python-INFO1-CE9990/master/$1.py >> $1.py
then
        echo $0: could not get $1.py 1>&2
        rm $1.py
        exit 1
fi

chmod 755 $1.py
$1.py

Command line programs

See if you installed the three programs that can be launched from the Linux command line.

python3

$ which python3
/usr/bin/python3

$ python3 --version
Python 3.7.4

$ python3 --version --version
Python 3.7.4 (default, Dec 13 2019, 01:02:18) 
[GCC 7.3.1 20180712 (Red Hat 7.3.1-6)]

$ python3 -c 'print(10 + 20)'
30

pip3

$ which pip3
/usr/bin/pip3

$ pip3 --version
pip 9.0.3 from /usr/lib/python3.7/site-packages (python 3.7)

$ pip3 --help

$ pip3 list
Package    Version
---------- -------
pip        9.0.3  
setuptools 38.4.0

pydoc3

$ which pydoc3
/usr/bin/pydoc3

$ pydoc3 topics
$ pydoc3 topics EXPRESSIONS

$ pydoc3 modules
$ pydoc3 modules sys

$ pydoc3 -b
Server ready at http://localhost:34743/
Server commands: [b]rowser, [q]uit
server> q
$

Compiled vs. interpreted languages

  1. Compiled languages: C, C++, Apple Swift
  2. Interpreted languages: Python, Ruby, Perl, JavaScript, awk, bash. These are languages whose scrpts start with #! on Linux. See man 2 execve
  3. Half compiled, half interpreted: Java (javac and javac). The JVM (Java Virtual Machine) is implemented by an interpreter. C# too.

Here is a statement in an imaginary language which looks very much like Java or Python:

print(10 + 20)

If you input this statement into an interpreter, the output of the interpreter will be

30

If you input this statement into a compiler, the output of the compiler will be

10010110 00001010      //Load 10 into a register.
10011011 00010100      //Add 20 to a register.  The register now holds the sum.
10111001               //Push the contents of the register onto the runtime stack.
11001010 11111000      //Call the print function (assume its address is 1111000)