Error in installing Python 3.7 in CentOS 7.6 zipimport.ZipImportError : can’t decompress data; zlib not available

Problem description

In CentOS 7.6, when you execute make install with Python 3.7.3 source code, the following error will be reported:

(cd /usr/local/share/man/man1; ln -s python3.7.1 python3.1)
if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "/home/Python-3.7.3/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/Python-3.7.3/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/Python-3.7.3/Lib/ensurepip/__main__.py", line 5, in 
    sys.exit(ensurepip._main())
  File "/home/Python-3.7.3/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/home/Python-3.7.3/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/home/Python-3.7.3/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

System version

[root@devEnv ]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

Python version

Python-3.7.3

Questions

Solutions

yum install zlib zlib-devel -y

Similar Posts: