Home >Backend Development >Python Tutorial >Tutorial on how to install Python 3.6.0 from source in Ubuntu 16.04 LTS
Premise
The official website provides installation packages for Mac and Windows and the source code required for installation on Linux.
The download address is as follows:
https://www.python.org/downloads/release/python-360/
Installation
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz xz -d Python-3.6.0.tar.xz tar -xvf Python-3.6.0.tar cd Python-3.6.0 ./configure make sudo make install
Test:
$ python3.6 --version Python 3.6.0
Test several new grammatical features:
1.
# Formatted string literals >>> name = 'Ray' >>> f"Hello {name}." 'Hello Ray.'
The effect is equivalent to
>>> name = 'Ray' >>> "Hello {name}.".format(name=name) 'Hello Ray.'
2.
# Underscores in Numeric Literals >>> a = 1_000_000_000_000_000 >>> a 1000000000000000 >>> '{:_}'.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 compiling and installing for the first time, you may find that after entering python3.6, the direction keys become invalid.
The reason is that the readline library is not installed.
Solution:
Install readline library
sudo apt-get install libreadline-dev
After installation, recompile and install python again.
cd Python-3.6.0 ./configure make sudo make install
Summary
The above is the entire content of this article. I hope the content of this article can bring some help to everyone's study or work. If you have any questions, you can leave a message to communicate.
For more tutorials on how to install Python 3.6.0 from source code in Ubuntu 16.04 LTS, please pay attention to the PHP Chinese website!