1

我正在尝试adns-python使用 linux 安装并且必须adns使用一些特殊选项重新编译,所以我似乎无法easy_install <tarball>像往常一样使用

(py26_default)[mpenning@localhost src]$ easy_install adns-python-1.2.1.tar.gz
Processing adns-python-1.2.1.tar.gz
Running adns-python-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-9cVl4i/adns-python-1.2.1/egg-dist-tmp-vvO8Ms
adnsmodule.c:10:18: error: adns.h: No such file or directory
adnsmodule.c:31: error: expected specifier-qualifier-list before âadns_stateâ

adns.h安装在/opt/adns/include/adns.h; 如何使用本地安装进行 easy_install 安装adns

编辑

在下面的尝试之后,我仍然发现一个ld错误,即使我导出LD_LIBRARY_PATH了......

(py26_default)[mpenning@localhost src]$ ls /opt/adns/lib/
libadns.a  libadns.so  libadns.so.1  libadns.so.1.2
(py26_default)[mpenning@localhost src]$ export LD_LIBRARY_PATH=/opt/adns/lib
(py26_default)[mpenning@localhost src]$ C_INCLUDE_PATH=/opt/adns/include easy_install ./adns-python-1.2.1.tar.gz
Processing adns-python-1.2.1.tar.gz
Running adns-python-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-x68T9f/adns-python-1.2.1/egg-dist-tmp-MpCzMP
/usr/bin/ld: cannot find -ladns
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1
(py26_default)[mpenning@localhost src]$ 
4

2 回答 2

3

LD_LIBRARY_PATH 用于在运行时(运行可执行文件时)而不是在链接期间查找共享库。

要构建扩展,解压缩 tarball 并运行:

python setup.py build_ext -I/opt/adns/include -L/opt/adns/lib -R/opt/adns/lib

安装:

python setup.py install

您可以在以下位置指定 build_ext 选项setup.cfg

[build_ext]
include_dirs=/opt/adns/include
library_dirs=/opt/adns/lib
rpath=/opt/adns/lib

在这种情况下,您可以直接运行 easy_install。

于 2012-08-12T00:31:47.067 回答
0

请尝试这样

INCLUDE_PATH=/opt/adns/include easy_install adns-python-1.2.1.tar.gz

如果它不起作用,请尝试使用CPLUS_INCLUDE_PATHC_INCLUDE_PATH

于 2012-08-09T19:03:54.273 回答