As Python updates, the new version is different from the old version of the feature point, as a beginner should understand the old version of the rules, but also continue to learn the new version of knowledge. In order to be able to learn Python better, I installed python2 and Python in Ubuntu
3 for later study.
The installation steps are as follows:
1. See if Python is installed under the system
Dpkg-s python
Ubuntu 12.04 comes with the Python2.7.3 version
2, the use of Apt-get mode installation 2.7.3 version
Apt-get Install Python
3. Install other versions, such as python3.5
(1) Installing dependent packages and libraries
Note: Because of the need to install in a compiled manner, a large number of libraries and dependent packages are needed, so we need to make them ready before compiling.
sudo apt-get install build-essential libncursesw5-dev libreadline6-dev libssl-dev libgdbm-dev Libc6-dev Libs
Qlite3-dev Tk-dev bzip2 libbz2-dev-y
(2) Download source code
wget HTTP://WWW.PYTHON.ORG/FTP/PYTHON/3.5.2/PYTHON-3.5.2.TAR.XZ
(3) Decompression and installation
Tar xvf python-3.5.2.tar.xz -c/usr/local/src #解压
cd/usr/local/src/python-3.5.2 #进入解压目录
./configure--prefix=/opt/python3 #/opt/python3.5.2 is a Python installation directory, or you can select a different directory
Make && make install #安装
(4) After installation, a soft connection is established so that the python3 can be called directly.
Ln-s/opt/python3/bin/python3.5/usr/local/bin/python3
4. Testing
Python2
Python3
Python based on the installation of two versions of Python under Ubuntu system