- cd 到/tmp目录下
- wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz ##下载包
- tar -xzvf Python-3.6.6.tgz -C /tmp ##解压
- cd Python-3.6.6/ ##进入
- ./configure --prefix=/usr/local
- make
- make altinstall
- ln -s /usr/local/bin/python3.6 /usr/bin/python3 ##Python建立软连接
- ln -s /usr/local/bin/pip3.6 /usr/bin/pip ##pip建立软连接
异常处理:
错误一:configure: error: in `Python-3.6.5': configure: error: no a ### 缺少依赖包
可能用到的依赖包报上面的错运行一下下面的命令就好了
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
错误二:zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [altinstall] Error 1
解决:yum -y install zlib* 稍后继续执行
错误三:
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
这个错是缺少GCC软件套件
执行:yum install gcc 安装一下gcc套件就好了
来源:oschina
链接:https://my.oschina.net/u/4361935/blog/4725266