How to Install Python 3.8 in Ubuntu

How to Install Python 3.8 in Ubuntu. Upgrade Python 3.7 to 3.8 Ubuntu. How to install Python on Linux. How to install Python via Ubuntu command line – Ubuntu install pip.

The Python Package Index (PyPI) hosts thousands of third-party modules for Python. Both Python’s standard library and the community-contributed modules allow for endless possibilities.

Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use.

The new features in Python 3.8, compared to 3.7.

  • Assignment expressions – There is new syntax (the “walrus operator”, :=) to assign values to variables as part of an expression
  • Positional-only parameters – There is new syntax (/) to indicate that some function parameters must be specified positionally (i.e., cannot be used as keyword arguments). This is the same notation as shown by help() for functions implemented in C (produced by Larry Hastings’ “Argument Clinic” tool).
  • Parallel filesystem cache for compiled bytecode files – The new PYTHONPYCACHEPREFIX setting (also available as -X pycache_prefix) configures the implicit bytecode cache to use a separate parallel filesystem tree, rather than the default __pycache__ subdirectories within each source directory. The location of the cache is reported in sys.pycache_prefix (None indicates the default location in __pycache__ subdirectories).
  • Debug build uses the same ABI as release build – Python now uses the same ABI whether it built in release or debug mode. On Unix, when Python is built in debug mode, it is now possible to load C extensions built in release mode and C extensions built using the stable ABI. Release builds and debug builds are now ABI compatible.
  • On Unix, C extensions are no longer linked to libpython except on Android and Cygwin. It is now possible for a statically linked Python to load a C extension built using a shared library Python. (Contributed by Victor Stinner in bpo-21536.)
  • On Unix, when Python is built in debug mode, import now also looks for C extensions compiled in release mode and for C extensions compiled with the stable ABI.
    f-strings now support = for quick and easy debugging – Add = specifier to f-strings. f'{expr=}’ expands to the text of the expression, an equal sign, then the repr of the evaluated expression.
  • PEP 587: Python Initialization Configuration – The PEP 587 adds a new C API to configure the Python Initialization providing finer control on the whole configuration and better error reporting.

Other Language Changes

  • A continue statement was illegal in the finally clause due to a problem with the implementation. In Python 3.8 this restriction was lifted. (Contributed by Serhiy Storchaka in bpo-32489.)
  • The int type now has a new as_integer_ratio() method compatible with the existing float.as_integer_ratio() method. (Contributed by Lisa Roach in bpo-33073.)
  • Constructors of int, float and complex will now use the __index__() special method, if available and the corresponding method __int__(), __float__() or __complex__() is not available. (Contributed by Serhiy Storchaka in bpo-20092.)
  • Added support of N{name} escapes in regular expressions. (Contributed by Jonathan Eunice and Serhiy Storchaka in bpo-30688.)
  • Dict and dictviews are now iterable in reversed insertion order using reversed(). (Contributed by Rémi Lapeyre in bpo-33462.)
  • The syntax allowed for keyword names in function calls was further restricted. In particular, f((keyword)=arg) is no longer allowed. It was never intended to permit more than a bare name on the left-hand side of a keyword argument assignment term. See bpo-34641.
  • Iterable unpacking is now allowed without parentheses in yield and return statements. (Contributed by David Cuthbert and Jordan Chapman in bpo-32117.)
  • A backslash-character pair that is not a valid escape sequence generates a DeprecationWarning since Python 3.6. In Python 3.8 it generates a SyntaxWarning instead. (Contributed by Serhiy Storchaka in bpo-32912.)
  • The compiler now produces a SyntaxWarning in some cases when a comma is missed before tuple or list.
  • Arithmetic operations between subclasses of datetime.date or datetime.datetime and datetime.timedelta objects now return an instance of the subclass, rather than the base class. This also affects the return type of operations whose implementation (directly or indirectly) uses datetime.timedelta arithmetic, such as datetime.datetime.astimezone(). (Contributed by Paul Ganssle in bpo-32417.)
  • When the Python interpreter is interrupted by Ctrl-C (SIGINT) and the resulting KeyboardInterrupt exception is not caught, the Python process now exits via a SIGINT signal or with the correct exit code such that the calling process can detect that it died due to a Ctrl-C. Shells on POSIX and Windows use this to properly terminate scripts in interactive sessions. (Contributed by Google via Gregory P. Smith in bpo-1054041.)
  • Added new replace() method to the code type (types.CodeType). (Contributed by Victor Stinner in bpo-37032.)
  • For integers, the three-argument form of the pow() function now permits the exponent to be negative in the case where the base is relatively prime to the modulus. It then computes a modular inverse to the base when the exponent is -1, and a suitable power of that inverse for other negative exponents. (Contributed by Mark Dickinson in bpo-36027.)
  • When dictionary comprehensions are evaluated, the key is now evaluated before the value, as proposed by PEP 572.

Install Python

Run the following commands in terminal to install Python on Linux Ubuntu:

sudo apt-get update
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.8

Once installed, restart the system to apply changes.

How to Install Python 3.8 in Ubuntu originally posted on Source Digit – Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos.