pyenv:构建失败(Fedora 34 使用 python-build 20180424)

2023-11-22

我需要帮助通过 pyenv 安装 python

$ pyenv -v
pyenv 1.2.27

我尝试安装3.6.8版本

$ pyenv install 3.6.8

我收到错误

正在下载 Python-3.6.8.tar.xz... ->https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz正在安装 Python-3.6.8... /home/dn121283mvp1/.pyenv/plugins/python-build/bin/python-build:行 1804: 355307 分段错误(核心转储)“$PYTHON_BIN”-s -m Ensurepip ${ensurepip_opts} > /dev/null 2>&1 安装 piphttps://bootstrap.pypa.io/get-pip.py..。 /home/dn121283mvp1/.pyenv/plugins/python-build/bin/python-build:行 1785: 355338 分段错误(核心转储)“${PYTHON_BIN}”-s "${get_pip}" ${GET_PIP_OPTS} 1>&4 2>&1 错误:安装 pip 失败 通过 get-pip.py

构建失败(Fedora 34 使用 python-build 20180424)

检查或清理工作树 /tmp/python-build.20210506064823.343245 结果记录到 /tmp/python-build.20210506064823.343245.log

最后 10 行日志: install|*) Ensurepip="" ;; \ 经济和社会委员会; \ 。/Python -E -m Ensurepip \ $ensurepip --root=/ ; \ fi 查看链接:/tmp/tmp4a3uh2fu 收集 setuptools 收集 pip 安装 收集的软件包:setuptools、pip 成功安装 pip-18.1 安装工具-40.6.2

我需要 3.6.8 版本才能安装


您可以向 pyenv 传递补丁来修复此问题。

我在这里发布了一个解决方案https://github.com/pyenv/pyenv/issues/1889#issuecomment-837697366

您需要修补一些 Python 3.6 对象分配代码才能使用 16 字节对齐。这似乎在 Python 3.7 中得到了修复。

  • https://bugs.python.org/issue27987
  • https://bugs.python.org/file44413/alignment.patch

必须调整补丁才能不使用a and b父目录名称,然后将其提供给 pyenv。

在 Python 3.6.8 上进行测试,因为这就是我所需要的。

$ cat alignment.patch
--- Include/objimpl.h
+++ Include/objimpl.h
@@ -250,7 +250,7 @@
         union _gc_head *gc_prev;
         Py_ssize_t gc_refs;
     } gc;
-    double dummy;  /* force worst-case alignment */
+    long double dummy;  /* force worst-case alignment */
 } PyGC_Head;

 extern PyGC_Head *_PyGC_generation0;
--- Objects/obmalloc.c
+++ Objects/obmalloc.c
@@ -643,8 +643,8 @@
  *
  * You shouldn't change this unless you know what you are doing.
  */
-#define ALIGNMENT               8               /* must be 2^N */
-#define ALIGNMENT_SHIFT         3
+#define ALIGNMENT               16               /* must be 2^N */
+#define ALIGNMENT_SHIFT         4

 /* Return the number of bytes in size class I, as a uint. */
 #define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
$ pyenv install --patch 3.6.8 < alignment.patch
Downloading Python-3.6.8.tar.xz...
-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
Installing Python-3.6.8...
patching file Include/objimpl.h
Hunk #1 succeeded at 255 (offset 5 lines).
patching file Objects/obmalloc.c
Hunk #1 succeeded at 650 (offset 7 lines).
Installed Python-3.6.8 to /home/asdf/.pyenv/versions/3.6.8
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pyenv:构建失败(Fedora 34 使用 python-build 20180424) 的相关文章

随机推荐