【问题标题】:waf build system can not find python librarieswaf构建系统找不到python库
【发布时间】:2013-11-08 10:41:55
【问题描述】:

我正在尝试为 python3 构建 pycairo-1.0 并得到错误的输出

root@blackenedsun:/home/blackenedsun/Downloads/pycairo-1.10.0# ./waf configure --prefix=/usr 
  ./options()
Setting top to                           : /home/blackenedsun/Downloads/pycairo-1.10.0 
Setting out to                           : /home/blackenedsun/Downloads/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/local/bin/python
Checking for python version              : (3, 3, 2, 'final', 0)
Checking for library python3.3 in LIBDIR : not found 
Checking for library python3.3 in python_LIBPL : not found 
Checking for library python3.3 in $prefix/libs : not found 
Checking for library python3.3m in LIBDIR      : yes 
Checking for program python3.3-config          : /usr/bin/python3.3-config 
command ['/usr/local/bin/python', '/usr/bin/python3.3-config', '--includes'] returned 1
root@blackenedsun:/home/blackenedsun/Downloads/pycairo-1.10.0# 

如何才能正确找到 python3.3 库?

【问题讨论】:

  • 您可以检查 /usr/local/bin/python 是否在那个地方或到某个其他位置的符号链接,如果它的链接可能被获取并将其传递给 waf..

标签: python build waf pycairo


【解决方案1】:

我在 python 3.4 上遇到了同样的问题。

这是由于 waf 试图用 python 执行 python3.4-config 而 python3.4-config 是一个 shell 脚本。

事实上,单独启动 python3.4-config 效果很好。

[dusserm@l92-ci-e pycairo-1.10.0]$ python3 /Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config --includes 文件“/Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config”,第 7 行 echo "用法:$0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir" ^ SyntaxError:无效的语法 [dusserm@l92-ci-e pycairo-1.10.0]$ /Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config --includes -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1/include/python3.4m -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1 /include/python3.4m

问题来自 waf 没有正确使用 python3.X-config。

我找到的解决方法是直接修改 waf 脚本解压缩的隐藏目录(在我的例子中是 .waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6)。 到这个目录下修改waflib/Tools/python.py文件,直接调用python3.X-config,不用python。

--- waflib/Tools/python.py.old  2014-08-01 14:36:23.750613874 +0000
+++ waflib/Tools/python.py      2014-08-01 14:36:38.359627761 +0000
@@ -169,7 +169,7 @@
                conf.find_program('python-config-%s'%num,var='PYTHON_CONFIG',mandatory=False)
        includes=[]
        if conf.env.PYTHON_CONFIG:
-               for incstr in conf.cmd_and_log(conf.env.PYTHON+[conf.env.PYTHON_CONFIG,'--includes']).strip().split():
+               for incstr in conf.cmd_and_log([conf.env.PYTHON_CONFIG,'--includes']).strip().split():
                        if(incstr.startswith('-I')or incstr.startswith('/I')):
                                incstr=incstr[2:]
                        if incstr not in includes:

【讨论】:

  • wtf,这仍然未修复 -.-' 但即使在更改后也只会给出“非常有用”的错误:Execution failure - 很棒。
【解决方案2】:

我遇到了同样的问题。我通过添加这样的系统变量来修复:
['/usr/local/bin/python3.4', '/usr/local/bin/python3.4-config', '--includes'] 返回 1

export PYTHON_CONFIG="/usr/local/lib/python3.4/config-3.4m/python-config.py"

【讨论】:

    猜你喜欢
    • 2015-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    相关资源
    最近更新 更多