Python的轻松安装和自定义头/库位置

2024-06-06 14:27:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用linux安装^{},并且不得不用一些特殊的选项重新编译^{},所以我似乎不能像平常那样使用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下;如何在本地安装{}的情况下轻松安装?在

编辑

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

^{pr2}$

Tags: installegglinuxdist选项easyerrortar
2条回答

请这样试一下

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

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

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

要构建扩展,请打开tarball并运行:

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

要安装:

^{pr2}$

您可以在setup.cfg中指定生成扩展选项:

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

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

相关问题 更多 >