场景描述
需要从源代码编译安装python-3.6.1的版本
环境描述
python-2.7.5, Centos 7
步骤重复
- 解压缩python-xx.tgz
- 进入源代码目录
- ./configure
- make & make install
碰到的问题:
Traceback (most recent call last):
File “/root/tools/Python-3.6.1/Lib/runpy.py”,line 193,in _run_module_as_main
“main“,mod_spec)
File “/root/tools/Python-3.6.1/Lib/runpy.py”,line 85,in _run_code
exec(code,run_globals)
File “/root/tools/Python-3.6.1/Lib/ensurepip/main.py”,line 4,in
ensurepip._main()
File “/root/tools/Python-3.6.1/Lib/ensurepip/init.py”,line 189,in _main
default_pip=args.default_pip,
File “/root/tools/Python-3.6.1/Lib/ensurepip/init.py”,line 102,in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS],additional_paths)
File “/root/tools/Python-3.6.1/Lib/ensurepip/init.py”,line 27,in _run_pip
import pip
zipimport.ZipImportError: can’t decompress data; zlib not available
make: * [install] Error 1
问题分析
从错误信息分析,就是缺少了zlib的解压缩类库,安装即可
yum -y install zlib*
安装完成之后,重新安装即可,所有的问题都已经正常解决了