在Ubuntu 16.04上编译cpython代码

Ann*_*pad 9 cpython ubuntu-16.04

我在这里的官方cpython代码链接上的说明如下.我做了一个

hg update 3.5
Run Code Online (Sandbox Code Playgroud)

然后做了以下.

sudo apt-get build-dep python3.5
Run Code Online (Sandbox Code Playgroud)

但它引发了一个错误,说明下面列出的语句:

Reading package lists... Done
Picking 'python3-defaults' as source package instead of 'python3'
E: Unable to find a source package for python3
Run Code Online (Sandbox Code Playgroud)

我确实读到了关于减少版本和尝试上面的代码集的问题,这也是因为以下原因引起的.

$ hg update 2.7
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ sudo apt-get build-dep python2.7
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
builddeps:python2.7 : Depends: libdb5.1-dev but it is not installable
E: Unable to correct problems, you have held broken packages
Run Code Online (Sandbox Code Playgroud)

为解决上述错误,我执行了以下操作,这也引发了错误.

$ sudo apt-get install libdb5.1-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libdb5.1-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libdb5.1-dev' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

要解决该错误,我尝试执行以下操作.

$ sudo apt-get install libdb5.1++-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libdb5.1++-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libdb5.1++-dev' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

最后我做到了这一点.

sudo apt-get install libdb++-dev
Run Code Online (Sandbox Code Playgroud)

它已经安装,但build-dep没有指向它,仍然会引发错误.

我不确定出了什么问题?有人可以帮忙吗?

提前致谢!

Dan*_*art 5

你没有说你有什么版本的 libdb。Libdb++ 仅适用于将使用 C++ 接口的程序,我认为您不需要。我看到 libdb 版本 5.3.21 和 libdb4 版本 4.8.30。如果您已经有 5.3.21 版,那么动态库应该是用户 /usr/lib64 作为 libdb-5.3.so 和指向该库 libdb-5.so 的链接。(我在 CentOS 上工作,所以它可能与 Ubuntu 略有不同。)您可以创建从 libdb-5.1.so 到您拥有的库的另一个链接,重新安装 python3.5 并告诉 apt-get 使用 --no 忽略依赖项-deps 选项。