安装 readline 模块后 Python 3.6.1 崩溃 [英] Python 3.6.1 crashed after readline module installed

查看:65
本文介绍了安装 readline 模块后 Python 3.6.1 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从源代码编译并安装了 Python 3.6.1,然后运行 ​​sudo pip3 install readline 来安装 readline 模块.但是当我启动 Python shell 时,无论我输入什么,它都会崩溃:

I've compiled and installed Python 3.6.1 from source code, and run sudo pip3 install readline to install the readline module. But when I start the Python shell, it crashes whatever I enter:

Python 3.6.1 (default, Mar 25 2017, 13:40:56) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello")
*** Error in `python3': munmap_chunk(): invalid pointer: 0x00007fa3c64960a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fa3c565e7e5]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7fa3c566aae8]
python3(PyOS_Readline+0xec)[0x5c3bcc]
python3[0x447cd0]
python3[0x449788]
python3(PyTokenizer_Get+0x9)[0x44a659]
python3[0x44617e]
python3(PyParser_ASTFromFileObject+0xa3)[0x428803]
python3(PyRun_InteractiveOneObject+0x122)[0x428a42]
python3(PyRun_InteractiveLoopFlags+0x6e)[0x428dce]
python3(PyRun_AnyFileExFlags+0x3c)[0x428efc]
python3(Py_Main+0xe4f)[0x43ba3f]
python3(main+0x162)[0x41dc52]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fa3c5607830]
python3(_start+0x29)[0x41dd29]
======= Memory map: ========
00400000-00663000 r-xp 00000000 08:05 16779642                           /usr/local/bin/python3.6
00862000-00863000 r--p 00262000 08:05 16779642                           /usr/local/bin/python3.6
00863000-008c7000 rw-p 00263000 08:05 16779642                           /usr/local/bin/python3.6
008c7000-008f7000 rw-p 00000000 00:00 0 
00d60000-00e31000 rw-p 00000000 00:00 0                                  [heap]
7fa3c4a96000-7fa3c4aac000 r-xp 00000000 08:05 528788                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fa3c4aac000-7fa3c4cab000 ---p 00016000 08:05 528788                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fa3c4cab000-7fa3c4cac000 rw-p 00015000 08:05 528788                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fa3c4cac000-7fa3c4cec000 rw-p 00000000 00:00 0 
7fa3c4cec000-7fa3c4d11000 r-xp 00000000 08:05 528922                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7fa3c4d11000-7fa3c4f10000 ---p 00025000 08:05 528922                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7fa3c4f10000-7fa3c4f14000 r--p 00024000 08:05 528922                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7fa3c4f14000-7fa3c4f15000 rw-p 00028000 08:05 528922                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7fa3c4f15000-7fa3c4f52000 r-xp 00000000 08:05 16786336                   /usr/local/lib/python3.6/site-packages/readline.cpython-36m-x86_64-linux-gnu.so
7fa3c4f52000-7fa3c5151000 ---p 0003d000 08:05 16786336                   /usr/local/lib/python3.6/site-packages/readline.cpython-36m-x86_64-linux-gnu.so
7fa3c5151000-7fa3c5153000 r--p 0003c000 08:05 16786336                   /usr/local/lib/python3.6/site-packages/readline.cpython-36m-x86_64-linux-gnu.so
7fa3c5153000-7fa3c515a000 rw-p 0003e000 08:05 16786336                   /usr/local/lib/python3.6/site-packages/readline.cpython-36m-x86_64-linux-gnu.so
7fa3c515a000-7fa3c515c000 rw-p 00000000 00:00 0 
7fa3c515c000-7fa3c55e7000 r--p 00000000 08:05 16253117                   /usr/lib/locale/locale-archive
7fa3c55e7000-7fa3c57a6000 r-xp 00000000 08:05 524633                     /lib/x86_64-linux-gnu/libc-2.23.so
7fa3c57a6000-7fa3c59a6000 ---p 001bf000 08:05 524633                     /lib/x86_64-linux-gnu/libc-2.23.so
7fa3c59a6000-7fa3c59aa000 r--p 001bf000 08:05 524633                     /lib/x86_64-linux-gnu/libc-2.23.so
7fa3c59aa000-7fa3c59ac000 rw-p 001c3000 08:05 524633                     /lib/x86_64-linux-gnu/libc-2.23.so
7fa3c59ac000-7fa3c59b0000 rw-p 00000000 00:00 0 
7fa3c59b0000-7fa3c5ab8000 r-xp 00000000 08:05 524562                     /lib/x86_64-linux-gnu/libm-2.23.so
7fa3c5ab8000-7fa3c5cb7000 ---p 00108000 08:05 524562                     /lib/x86_64-linux-gnu/libm-2.23.so
7fa3c5cb7000-7fa3c5cb8000 r--p 00107000 08:05 524562                     /lib/x86_64-linux-gnu/libm-2.23.so
7fa3c5cb8000-7fa3c5cb9000 rw-p 00108000 08:05 524562                     /lib/x86_64-linux-gnu/libm-2.23.so
7fa3c5cb9000-7fa3c5cbb000 r-xp 00000000 08:05 524647                     /lib/x86_64-linux-gnu/libutil-2.23.so
7fa3c5cbb000-7fa3c5eba000 ---p 00002000 08:05 524647                     /lib/x86_64-linux-gnu/libutil-2.23.so
7fa3c5eba000-7fa3c5ebb000 r--p 00001000 08:05 524647                     /lib/x86_64-linux-gnu/libutil-2.23.so
7fa3c5ebb000-7fa3c5ebc000 rw-p 00002000 08:05 524647                     /lib/x86_64-linux-gnu/libutil-2.23.so
7fa3c5ebc000-7fa3c5ebf000 r-xp 00000000 08:05 524547                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fa3c5ebf000-7fa3c60be000 ---p 00003000 08:05 524547                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fa3c60be000-7fa3c60bf000 r--p 00002000 08:05 524547                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fa3c60bf000-7fa3c60c0000 rw-p 00003000 08:05 524547                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fa3c60c0000-7fa3c60d8000 r-xp 00000000 08:05 524644                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fa3c60d8000-7fa3c62d7000 ---p 00018000 08:05 524644                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fa3c62d7000-7fa3c62d8000 r--p 00017000 08:05 524644                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fa3c62d8000-7fa3c62d9000 rw-p 00018000 08:05 524644                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fa3c62d9000-7fa3c62dd000 rw-p 00000000 00:00 0 
7fa3c62dd000-7fa3c6303000 r-xp 00000000 08:05 524634                     /lib/x86_64-linux-gnu/ld-2.23.so
7fa3c6339000-7fa3c64e2000 rw-p 00000000 00:00 0 
7fa3c64f8000-7fa3c64f9000 rw-p 00000000 00:00 0 
7fa3c64f9000-7fa3c6500000 r--s 00000000 08:05 16522416                   /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fa3c6500000-7fa3c6502000 rw-p 00000000 00:00 0 
7fa3c6502000-7fa3c6503000 r--p 00025000 08:05 524634                     /lib/x86_64-linux-gnu/ld-2.23.so
7fa3c6503000-7fa3c6504000 rw-p 00026000 08:05 524634                     /lib/x86_64-linux-gnu/ld-2.23.so
7fa3c6504000-7fa3c6505000 rw-p 00000000 00:00 0 
7ffcb1700000-7ffcb1721000 rw-p 00000000 00:00 0                          [stack]
7ffcb17ad000-7ffcb17af000 r--p 00000000 00:00 0                          [vvar]
7ffcb17af000-7ffcb17b1000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)

这是怎么回事?我使用的是 Ubuntu 16.04.

What's the matter here? I'm using Ubuntu 16.04.

推荐答案

改为尝试 pip install gnureadline.并删除readline:pip uninstall readline.

Try pip install gnureadline instead. And remove readline: pip uninstall readline.

pypi 上的 gnureadline 包页面所述.org:

某些平台(例如 macOS)未安装 GNU readline

Some platforms, such as macOS, do not ship with GNU readline installed

该模块[捆绑]了标准 Python readline 模块和 GNU readline 源代码,后者被编译并静态链接到它.最终结果是一个易于安装且不需要额外共享库的包.

This module [bundles] the standard Python readline module with the GNU readline source code, which is compiled and statically linked to it. The end result is a package which is simple to install and requires no extra shared libraries.

所以 gnureadline 包带有编译和链接所需的代码,而 内置 python readline 依赖于已经安装在系统上的 GNU readline(或替代方案).

So the gnureadline package comes with the required code compiled and linked whereas the builtin python readline library relies on GNU readline (or an alternative) to be installed on the system already.

这篇关于安装 readline 模块后 Python 3.6.1 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆