How to Learn: python learning path (1): python source code installation Preface
Python is a versatile language, especially in Linux. The general Linux system also comes with Python. However, it is still necessary to learn how to install Python in Linux.
Operating system version:
- Gaopeng @ gaopeng-virtual-machine :~ $ Uname-
- Linux gaopeng-virtual-machine 3.2.0-38-generic # 61-Ubuntu SMP Tue Feb 19 12:20:02 UTC 2013 i686 i686 i386 GNU/Linux
Python version:
- Gaopeng @ gaopeng-virtual-machine :~ $ Python
- Python 2.7.3 (default, Aug 1 2012, 05:16:07)
Install and configure Python
In essence, the steps for installing software in Linux are the same. Therefore, we will not explain it too much here, and run it directly to see the effect.
- Gaopeng @ gaopeng-virtual-machine :~ // Python $ wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
- -- 17:06:40 -- http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
- Parsing host www.python.org (www.python.org)... 82.94.164.162, 2001: 888: 2000: d: a2
- Connecting www.python.org (www.python.org) | 82.94.164.162 |: 80... already connected.
- An HTTP request has been sent and is waiting for response... 200 OK
- Length: 14492759 (14 M) [application/x-tar]
- Saving to: "Python-2.7.5.tgz"
-
- 100% [============================================== ==================>] 14,492,759 182 K/s 88 s
-
- 17:08:08 (162 KB/s)-saved "Python-2.7.5.tgz" [14492759/14492759])
Decompress the Python installation package.
- Gaopeng @ gaopeng-virtual-machine :~ /Python $ tar-zxvf Python-2.7.5.tgz
- Gaopeng @ gaopeng-virtual-machine :~ /Python $ ls
- Python-2.7.5 Python-2.7.5.tgz
The classic installation trilogy.
- Gaopeng @ gaopeng-virtual-machine :~ $ Cd python or Python-2.7.5/
- Gaopeng @ gaopeng-virtual-machine :~ /Python/Python-2.7.5 $ sudo./configure -- prefix =/usr/local/python2.7.5
- Gaopeng @ gaopeng-virtual-machine :~ /Python/Python-2.7.5 $ sudo make
- Gaopeng @ gaopeng-virtual-machine :~ /Python/Python-2.7.5 $ sudo make install
-- Prefix =/usr/local/python2.7.5 indicates to specify the installation directory of the current program.
In order to avoid conflicts, we will proceed with the soft connection.
- Gaopeng @ gaopeng-virtual-machine :~ /Python/Python-2.7.5 $ sudo ln-s/bin/local/python2.7.5/bin/python/bin/python2.7.5
Install EasyInstall source code
First, download the source code package.
- Gaopeng @ gaopeng-virtual-machine :~ // Python $ wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
Decompress the source code package.
- Gaopeng @ gaopeng-virtual-machine :~ /Python $ tar-zxvf setuptools-0.6c11.tar.gz
Build and install.
- Gaopeng @ gaopeng-virtual-machine :~ /Python $ cd setuptools-0.6c11/
- Gaopeng @ gaopeng-virtual-machine :~ /Python/setuptools-0.6c11 $ sudo python2.7.5 setup. py build
- Gaopeng @ gaopeng-virtual-machine :~ /Python/setuptools-0.6c11 $ sudo python2.7.5 setup. py install
Establish a soft connection.
- Gaopeng @ gaopeng-virtual-machine :~ /Python/Python-2.7.5 $ sudo ln-s/bin/local/python2.7.5/bin/easy_install/bin/ey2.7.5