LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

python2.7

Legacy Python 2.7 interpreter

TLDR

Run Python 2.7 script
$ python2.7 [script.py]
copy
Interactive mode
$ python2.7
copy
Execute command
$ python2.7 -c "[print 'hello']"
copy
Run module
$ python2.7 -m [module]
copy

SYNOPSIS

python2.7 [options] [script] [args]

DESCRIPTION

python2.7 is the Python 2.7 interpreter. Python 2 reached end-of-life on January 1, 2020, and should only be used for legacy code maintenance.Use Python 3 for all new development.

PARAMETERS

-c command

Execute command.
-m module
Run library module.
-i
Interactive after script.
-u
Unbuffered I/O.
-O
Optimize bytecode.
-v
Verbose imports.
-V
Print version.

EXAMPLES

$ # Run script
python2.7 legacy_script.py

# Check version
python2.7 --version

# One-liner (note print statement)
python2.7 -c "print 'Hello, Python 2'"

# Install pip for Python 2
python2.7 -m ensurepip
copy

KEY DIFFERENCES FROM PYTHON 3

$ # Python 2 syntax
print "hello"              # Statement
raw_input("Name: ")        # User input
unicode_string = u"text"   # Unicode prefix
5 / 2 == 2                 # Integer division
copy

CAVEATS

Python 2 is EOL and receives no updates. Security vulnerabilities unfixed. Migrate to Python 3.

HISTORY

Python 2.0 was released in 2000. Python 2.7 was the final 2.x release (2010), with support ending January 1, 2020.

SEE ALSO

python3(1), 2to3(1), pip(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid