Python的easy

编程入门 行业动态 更新时间:2024-10-25 07:35:00
本文介绍了Python的easy_install和自定义标头/库位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I am trying to install adns-python using linux and had to recompile adns with some special options, so I can't seem to use easy_install <tarball> as I normally would

(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下;如何使用adns的本地安装进行easy_install安装?

adns.h is installed under /opt/adns/include/adns.h; how can I make easy_install install with a local installation of adns?

编辑

经过下面的尝试,即使我导出了LD_LIBRARY_PATH ...,我仍然发现ld错误.

After the attempt below, I still find an ld error, even though I exported 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]$

推荐答案

LD_LIBRARY_PATH用于在运行时(运行可执行文件时)而不是在链接过程中查找共享库.

LD_LIBRARY_PATH is used to find a shared library at runtime (when an executable is run), not during linking.

要构建扩展,请打开压缩包并运行:

To build the extension, unpack the tarball and run:

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

要安装:

python setup.py install

您可以在setup.cfg中指定build_ext选项:

You could specify build_ext options in setup.cfg:

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

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

in this case you could run easy_install directly.

更多推荐

Python的easy

本文发布于:2023-07-05 01:16:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1031271.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Python   easy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!