1.操作系统以及版本显示
# uname -sr Linux 3.10.0-514.el7.x86_64
# uname -sr Linux 3.10.0-514.el7.x86_64
2.下载Python安装包
# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
3.开始进行编译安装python
3.1 解压python
# tar -xf Python-3.6.1.tar.xz
3.2 获取帮助
# cd Python-3.6.1/ # cat README.rst
3.3 查看编译的参数
# ./configure --help
3.4 开始编译
# yum install -y gcc gcc-c++ # ./configure --prefix=/usr/local/python-3.6 # make && make install
3.5 测试
[root@localhost Python-3.6.1]# /usr/local/python-3.6/bin/python3.6 Python 3.6.1 (default, May 10 2017, 08:59:54) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
4.出现的错误以及解决办法
在进行make install 的时候出现了以下信息,安装被终止
zipimport.ZipImportError: can't decompress data; zlib not available
解决办法:
# yum install -y zlib zlib-devel
Linux安装Python 3.5.2 http://www.linuxidc.com/Linux/2017-10/147579.htm
Ubuntu 16.04下安装Vim8并支持Python3 http://www.linuxidc.com/Linux/2017-09/147108.htm
Python之装饰器、迭代器和生成器 http://www.linuxidc.com/Linux/2017-07/145883.htm
深入浅出理解Python 装饰器 http://www.linuxidc.com/Linux/2017-08/146312.htm
Python编程:从入门到实践 超清晰PDF完整版+源代码 http://www.linuxidc.com/Linux/2017-06/145208.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-10/147891.htm