问题描述
我有一个带有 Debian 7.1 的虚拟 Linux 机器,我需要一个 Python 2.4.6 来恢复旧的 Zope 安装(当然是为了将其更新到 Plone 4).
I have a virtual Linux box with Debian 7.1 where I need a Python 2.4.6 to reanimate an old Zope installation (in order to update it to Plone 4, of course).
我当然需要ssl
支持,而且当我编译时,我当然也需要readline
.最后,我当然需要zlib
,否则ez_setup.py
等将不起作用;我很难让 zlib
包含在内.
I definitely need ssl
support, and when I'm compiling, I want readline
as well, of course. Finally, of course I need zlib
, otherwise ez_setup.py
etc. won't work; I'm having a hard time to get zlib
included.
我下载了 Python 2.4.6 的压缩包,在 Modules/Setup.dist
中启用了 ssl
:
I downloaded the tarball of Python 2.4.6, enabled ssl
in Modules/Setup.dist
:
SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto
...并调用:
./configure --prefix=/my/dest/dir --with-zlib
make
make
最后给了我一些关于 crypt
和 nis
的警告,但 make install
没有产生任何错误.但是,生成的 Python 功能同时支持 readline
和 ssl
,但不支持 zlib
;因此,我不能使用 ez_setup.py
来获取 setuptools/pip 等.
make
gives me some warnings at the end about crypt
and nis
, but make install
doesn't yield any errors. However, the resulting Python features both readline
and ssl
support, but no zlib
; thus, I can't use ez_setup.py
to get setuptools/pip etc.
我尝试取消注释并重新排除该行
I tried both to uncomment and re-exclude the line
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
来自 Setup.dist
.
已安装的一些系统包:
zlib1g-dev
lib32z1-dev
libreadline-gplv2-dev
我还有什么遗漏的吗?
更新,在阅读https://stackoverflow.com/a/4047583/1051649:
我做到了
$ sudo apt-get install zlib1g zlib1g-dev libncurses5-dev libreadline6-dev ncurses-doc
$ python setup.py clean
$ ./configure --with-ssl --with-zlib --prefix=...
$ make
$ sudo make install
生成的解释器无法执行 distribute_setup.py
.
The resulting interpreter was not able to execute distribute_setup.py
.
推荐答案
我找到了解决方案 这里:
我更改了 setup.py
,寻找 lib_dirs 变量的第一个赋值,将其更改如下:
I changed setup.py
, looking for the first assignment to the lib_dirs variable, changing it like so:
lib_dirs = self.compiler.library_dirs + [
'/lib64', '/usr/lib64',
'/lib', '/usr/lib',
'/usr/lib/x86_64-linux-gnu', # added
'/usr/lib/i386-linux-gnu', # added
]
然后我重复了整个过程,从 setup.py clean
开始,它成功了.
Then I repeated the whole thing, starting with setup.py clean
, and it worked.