在CentOS7上从源代码编译Python3.4时,无法构建可选模块readline和_curses

时间:2018-04-10 21:50:55

标签: python python-3.x centos readline

在CentOS 7上从源代码编译Python 3.4.3时,README指示运行

./configure
make
make test
sudo make install

在第二步,make,我看到了

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _curses               _curses_panel
_dbm                  _gdbm                 _lzma
_sqlite3              _ssl                  _tkinter
readline              zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

但是setup.py的源代码中没有任何内容表明该怎么做?好像我已经有了必要的包裹?

$ sudo yum install readline
...
Package readline-6.2-10.el7.x86_64 already installed and latest version
Nothing to do

如何获取python 3的readline模块?

1 个答案:

答案 0 :(得分:0)

安装readline-devel

$ sudo yum install readline-devel
[...]
Installed:
  readline-devel.x86_64 0:6.2-10.el7

Dependency Installed:
  ncurses-devel.x86_64 0:5.9-14.20130511.el7_4

Dependency Updated:
  ncurses.x86_64 0:5.9-14.20130511.el7_4   [...]

Complete!

然后重新运行make

$ make
[...]
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _dbm                  _gdbm
_lzma                 _sqlite3              _ssl
_tkinter              zlib

现在安装了readline_curses模块,缺少模块列表中没有。

我从这个问题的答案得到了提示:yum showing readline installed but readline command not working

这种模式证明适用于其他缺失的包。 ssl需要openssl-devel个包,zlib需要zlib-devel