如何解决pyenv:构建失败Fedora 34 使用 python-build 20180424
我需要帮助通过 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: line 1804:355307 分段错误(核心已转储)“$PYTHON_BIN”-s -m ensurepip ${ensurepip_opts} > /dev/null 2>&1 从安装 pip https://bootstrap.pypa.io/get-pip.py..。 /home/dn121283mvp1/.pyenv/plugins/python-build/bin/python-build: line 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="" ;; \ esac; \ 。/Python -E -m ensurepip \ $ensurepip --root=/ ; \ fi 查看链接:/tmp/tmp4a3uh2fu 收集 setuptools 收集 pip 安装 收集到的包:setuptools、pip 成功安装 pip-18.1 setuptools-40.6.2
我需要安装 3.6.8 版
解决方法
您可以将补丁传递给 pyenv 来解决此问题。
我在这里发布了一个解决方案https://github.com/pyenv/pyenv/issues/1889#issuecomment-837697366
您需要修补一些 Python 3.6 对象分配代码以使用 16 字节对齐。这似乎已在 Python 3.7 中修复。
在将补丁提供给 pyenv 之前,必须调整补丁以不使用 a
和 b
父目录名称。
在 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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。