我是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
我最担心的是_ssl模块。我使用了./configure --with-ssl,如提到in another post,但消息仍然相同。任何指针都赞赏。
补充说明:习惯于抱怨它无法构建bz2,但我修复了with this post entry重新编译bzip2。现在它归结为_ssl。我不确定我是否需要_curses。
编辑:找到make日志文件,看起来这是因为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
This blog在没有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
以下是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
编辑3:是的,谢谢你们提出这些问题。当我查看我之前安装的软件包时,一个显然看起来不太好,libncursesw5-dev(因为它有一个版本,我从一个旧帖子中得到它)。我尝试了以下内容,它解决了_curses和_curses_panel没有构建的问题:
apt-get install libncurses-dev
安装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
答案 0 :(得分:2)
你没有给我们足够的信息来真正知道发生了什么;构建输出和构建日志是有原因的......
但我能以80%的信心猜测:
您没有安装正确的标头来构建它们。
例如,如果您已为libssl
安装了dpkg但未安装libssl-dev
,则无法构建_ssl
。在Ubuntu上,只需sudo apt-get install libssl-dev
并修复它。在不同的发行版中,它可能类似libssl-devel
,ssl-dev
等。但是开发pacakages的基本概念在任何地方都是相同的:运行需要foo
的程序,您只需要foo
包,但要构建需要foo
的程序,您还需要foo
开发包。
对于其中一些库来说,你丢失哪个包并不是很明显,但你仍然可以通过查看日志来告诉它找不到的库或头文件的名称,而你可以在Ubuntu论坛上搜索或询问,找出哪个包提供了丢失的文件。
答案 1 :(得分:2)
以下是我在ubuntu 12.10上解决pythong 2.6.5安装的方法:
1。)我尝试安装以下库(一些已经在系统上):
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 libncurses-dev
2。)bz2模块未构建问题:
a。)我从http://www.bzip.org/downloads.html下载了bz2源代码。
b。)修改了Makefile并将cc=gcc
更改为'cc = gcc -fPIC`
关注this post。
C。)
执行make和make install。
d。)使用命令行中的以下代码测试bz2:
python -c“import bz2; print bz2。 doc ”
3。)_ssl模块未构建问题:
a。)通过从python源删除ssl v2修复了ssl。遵循说明in this blog by Michael Schurter。它就像一个魅力。
4.。)此时我使用make altinstall
安装了Python 2.6.5,以免覆盖现有的python。我将/ usr / bin / python指向我的新python安装。还有一些东西不见了。
5.)添加了ez_setup: 卷曲-O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py python ez_setup.py
6。)添加了点子: easy_install -U pip
7.。)已安装的setuptools: pip install setuptools
此时它看起来一切正常!