概述
之前用的很多都是Python3.6版本,所以不知道3.7版本在编译安装时居然有一个小坑,这里简单记录一下,以作备忘!
报错信息
Traceback (most recent call last):
File "/opt/Python-3.7.0/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/Python-3.7.0/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/Python-3.7.0/Lib/ensurepip/__main__.py", line 5, in
sys.exit(ensurepip._main())
File "/opt/Python-3.7.0/Lib/ensurepip/__init__.py", line 204, in _main
default_pip=args.default_pip,
File "/opt/Python-3.7.0/Lib/ensurepip/__init__.py", line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/opt/Python-3.7.0/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] 错误 1
报错截图:
思路
一般位于3.7以上版本编译安装时出错提示缺少依赖包libffi-devel,是由于在安装3.7以上版本时,需要一个新的libffi-devel包做依赖。
解决方法
yum install libffi-devel -y
重新make &&make install
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~