1.在官網上下載Python的Linux源碼包
2.解壓源碼包,在下載文件夾中解壓就可以了,安裝的時候系統會自動安裝到默認的應用目錄
3.在解壓後的文件夾中執行 ./configure 命令
最後會提示生成了 MakeFIle文件
4.執行 make 命令,生成可執行文件
5.執行 make install 命令
以上2-5步驟,是安裝源碼包的一般步驟
cent os7上安裝的時候遇到的問題:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/data/python/Python-2.7.8':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
查了一下,發現有一種可能是沒有安裝gcc編譯器,查看了一下本機
gcc -v
果然沒有安裝gcc編譯器,所以先執行
yum install gcc 安裝一下再去執行安裝python