安装 python 2.6.5 时出现“无法构建这些模块:_curses _curses_panel _ssl”

Lid*_*dia 6 python ubuntu

我是 python 和 ubuntu 的新手。我正在尝试在 ubuntu 12.10 上安装 python 2.6.5。我已经有了 python 2.7.3,并且正在尝试与现有的 python 并排安装 2.6.5。执行make时出现以下错误:

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_curses            _curses_panel      _ssl
Run Code Online (Sandbox Code Playgroud)

我最担心的是 _ssl 模块。我使用了 ./configure --with-ssl,如另一篇文章所述,但消息仍然相同。任何指针表示赞赏。

附加说明:make 曾经抱怨它也无法构建 bz2,但我通过这篇文章重新编译 bzip2修复了这个问题。现在归结为 _ssl。我不确定我是否需要 _curses。

编辑:找到 make log 文件,看起来这是因为 python 2.6.5 支持 ssl v2,而在 Ubuntu 中删除了此支持。日志文件包含:

*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-x86_64-2./_ssl.so: undefined symbol: SSLv2_method
Run Code Online (Sandbox Code Playgroud)

该博客在没有 ssl v2 支持的情况下重建了 python 2.6.8。我现在正在 2.6.5 源中尝试他们的更改。

编辑 2:如上所述修改 2.6.5 源并删除 ssl v2 支持修复了 _ssl 模块未构建的问题。此外,这是我之前尝试安装的软件包列表:

apt-get install libreadline-dev
apt-get install libssl-dev (already installed)
apt-get install libbz2-dev (already installed)
apt-get install build-essential (already installed)
apt-get install sqlite3
apt-get install tk-dev
apt-get install libsqlite3-dev
apt-get install libc6-dev (already installed)
apt-get install libgdbm-dev
apt-get install libncursesw5-dev
Run Code Online (Sandbox Code Playgroud)

这是 make 的完整输出:

running build
running build_ext
building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict prototypes -I. -I/tmp/nimbula/Python-2.6.5/./Include -I. -IInclude -I./Include -I/usr/local/include -I/tmp/nimbula/Python-2.6.5/Include -I/tmp/nimbula/Python-2.6.5 -c /tmp/nimbula/Python-2.6.5/Modules/_cursesmodule.c -o build/temp.linux-x86_64-2.6/tmp/nimbula/Python-2.6.5/Modules/_cursesmodule.o
building '_curses_panel' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/tmp/nimbula/Python-2.6.5/./Include -I. -IInclude -I./Include -I/usr/local/include -I/tmp/nimbula/Python-2.6.5/Include -I/tmp/nimbula/Python-2.6.5 -c /tmp/nimbula/Python-2.6.5/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.6/tmp/nimbula/Python-2.6.5/Modules/_curses_panel.o

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_curses            _curses_panel

running build_scripts
Run Code Online (Sandbox Code Playgroud)

编辑 3:是的,谢谢你们提出这些问题。当我查看我之前安装的软件包时,其中一个显然不好看,libncursesw5-dev(因为它有一个版本,而且我是从一篇旧帖子中得到的)。我尝试了以下方法,它解决了 _curses 和 _curses_panel 无法构建的问题:

apt-get install libncurses-dev
Run Code Online (Sandbox Code Playgroud)

安装 libncurses-dev 后,我执行:make clean, ./configure --with-ssl, make。

现在 make 的输出是:

running build
running build_ext

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

running build_scripts
Run Code Online (Sandbox Code Playgroud)

aba*_*ert 2

你没有给我们足够的信息来真正了解发生了什么;构建输出和构建日志存在是有原因的\xe2\x80\xa6

\n\n

但我可以有大约 80% 的把握猜测:

\n\n

您没有安装正确的标头来构建它们。

\n\n

例如,如果您安装了 dpkglibssl但没有安装 dpkg libssl-dev,则您将无法构建_ssl. 在 Ubuntu 上,只需sudo apt-get install libssl-dev修复该问题即可。在不同的发行版上,它可能类似于libssl-develssl-dev等。但是开发包的基本概念在任何地方都是相同的:要运行需要 的程序foo,您只需要foo包,但是要构建需要 的程序foo,您需要foo 开发包也是如此。

\n\n

对于其中一些库,您缺少哪个包并不那么明显,但您仍然应该能够通过查看日志来判断找不到的库或头文件的名称,并且您可以搜索,或者在 Ubuntu 论坛上询问,找出哪个软件包提供了缺少的文件。

\n