我一直在与这个 Python 3.6.1 安装作斗争。我正在尝试对其进行设置,以便任何用户都可以使用 3.6.1 运行脚本。请注意,Python 2.7.5 已安装。任何帮助将不胜感激。
红帽版本:
Linux version 3.10.0-514.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Wed Oct 19 11:24:13 EDT 2016
Python 3.6.1 安装错误:
Traceback (most recent call last):
File "/usr/src/Python-3.6.1/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/src/Python-3.6.1/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/src/Python-3.6.1/Lib/ensurepip/__main__.py", line 4, in <module>
ensurepip._main()
File "/usr/src/Python-3.6.1/Lib/ensurepip/__init__.py", line 189, in _main
default_pip=args.default_pip,
File "/usr/src/Python-3.6.1/Lib/ensurepip/__init__.py", line 102, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/usr/src/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
答案1
问题是安装之前未安装 zlib 和 zlib-devel。我还需要确保 openssl 和 openssl-devel 已安装且是最新的,因为 PIP 稍后无法运行。
我已在下面粘贴了必要的命令和依赖项。这是在 Redhat 4.8.5 上进行的。
yum install gcc
yum install zlib
yum install zlib-devel
yum install openssl
yum install openssl-devel
cd /usr/src
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar xzf Python-3.6.1.tgz
cd Python-3.6.1/
./configure
make
make altinstall