安装python 3.9时出现安装错误

安装python 3.9时出现安装错误

我一直在尝试在 antiX 19.3 上安装 python 3.9 ..我一直遵循的指南来自这里。我安装的差异如下:

sudo apt-get install build-essential 
sudo apt-get install libsqlite3-dev
sudo apt-get install libbz2-dev

最初的过程很顺利,除了这个命令:

sudo make install

日志文件粘贴在零箱(感谢pastebin的大小限制!) https://www.i1984.cz/paste/?ef63821f80bdba6f#tViAQ43HnOT6nqMq6V9rFclUig+/lVR/m+SDolo3nQI=

日志的最后一部分:

rm -f /usr/local/share/man/man1/python3.1
(cd /usr/local/share/man/man1; ln -s python3.9.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 "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 568, in _get_data
  File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/home/alex/Downloads/Python-3.9.0/Lib/runpy.py", line 206, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/home/alex/Downloads/Python-3.9.0/Lib/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/alex/Downloads/Python-3.9.0/Lib/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "<frozen zipimport>", line 241, in load_module
  File "<frozen zipimport>", line 709, in _get_module_code
  File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
  File "/home/alex/Downloads/Python-3.9.0/Lib/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/alex/Downloads/Python-3.9.0/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/alex/Downloads/Python-3.9.0/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/home/alex/Downloads/Python-3.9.0/Lib/ensurepip/__init__.py", line 210, in _main
    return _bootstrap(
  File "/home/alex/Downloads/Python-3.9.0/Lib/ensurepip/__init__.py", line 129, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/home/alex/Downloads/Python-3.9.0/Lib/ensurepip/__init__.py", line 38, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/home/alex/Downloads/Python-3.9.0/Lib/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/alex/Downloads/Python-3.9.0/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmphhr5gs_j/setuptools-49.2.1-py3-none-any.whl\', \'/tmp/tmphhr5gs_j/pip-20.2.3-py2.py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmphhr5gs_j\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1254: install] Error 1
make exited with status code 2

Mon Nov 30 15:43:51 2020
----------------

答案1

要在基于 debian 的系统上构建 python,您需要安装以下软件包:

sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git

libreadline-dev 的替代方案:

sudo apt install libedit-dev

常见构建问题:先决条件

相关内容