Tutorial on installing Python 3.6.0 in Ubuntu 16.04 LTS source code, 16.043.6.0
Prerequisites
The official website provides installation packages for Mac and Windows and the source code required for Linux installation.
As follows:
Https://www.python.org/downloads/release/python-360/
Install
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xzxz -d Python-3.6.0.tar.xztar -xvf Python-3.6.0.tarcd Python-3.6.0./configuremakesudo make install
Test:
$ python3.6 --versionPython 3.6.0
Test several new syntax features:
1.
# Formatted string literals>>> name = 'Ray' >>> f"Hello {name}." 'Hello Ray.'
Equivalent
>>> name = 'Ray' >>> "Hello {name}.".format(name=name)'Hello Ray.'
2.
# Underscores in Numeric Literals>>> a = 1_000_000_000_000_000>>> a1000000000000000>>> '{:_}'.format(1000000)'1_000_000''1_000_000'
3.
# Enum.auto>>> from enum import Enum, auto>>> class Color(Enum):... red = auto()... blue = auto()... green = auto()... >>> list(Color)[<Color.red: 1>, <Color.blue: 2>, <Color.green: 3>]
Tips
After the first compilation and installation, you may find that the direction keys are invalid after you input python3.6.
The reason is that the readline library is not installed.
Solution:
Install the readline Library
sudo apt-get install libreadline-dev
After installation, re-compile and install python.
cd Python-3.6.0./configuremakesudo make install
Summary
The above is all about this article. I hope this article will help you in your study or work. If you have any questions, please leave a message.