Linux CentOS下安装python3 报错: zipimport.ZipImportError: can't decompress data; zlib not available

Traceback (most recent call last):
  File "/root/Python-3.6.2/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/root/Python-3.6.2/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/Python-3.6.2/Lib/ensurepip/__main__.py", line 4, in 
    ensurepip._main()
  File "/root/Python-3.6.2/Lib/ensurepip/__init__.py", line 189, in _main
    default_pip=args.default_pip,
  File "/root/Python-3.6.2/Lib/ensurepip/__init__.py", line 102, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/root/Python-3.6.2/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] 错误 1

解决办法:

  1、安装依赖zlib、zlib-devel 以及 ncurses ncurses-devel

# yum -y install zlib zlib-devel

  2、重新编译安装Python

# make install

你可能感兴趣的:(Linux CentOS下安装python3 报错: zipimport.ZipImportError: can't decompress data; zlib not available)