【问题标题】:Python3.pc file not found with pkg-config使用 pkg-config 找不到 Python3.pc 文件
【发布时间】:2016-03-16 05:31:57
【问题描述】:

我在安装了 python3 的 Ubuntu 14.04 机器上。在 make 文件中,我的标志如下所示:

CFLAGS = -Wall -std=c11 -g -DNDEBUG `pkg-config --cflags python3`

运行 make 文件时出现错误:

gcc -Wall -std=c11 -g -DNDEBUG `pkg-config --cflags python3` -fPIC   -c -o calmodule.o calmodule.c
Package python3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `python3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'python3' found
gcc -shared  calmodule.o calutil.o -o Cal.so

我检查了 pkg-config 文件夹,并没有在其中找到 python:

  % la /usr/lib/pkgconfig
total 20K
-rw-r--r-- 1 root root 288 Jul 22  2015 dbus-python.pc
-rw-r--r-- 1 root root 452 Jul 22  2015 ibus-table.pc
-rw-r--r-- 1 root root 245 Jul 12  2014 libquvi-scripts.pc
-rw-r--r-- 1 root root 379 Jul 10  2014 pm-utils.pc
-rw-r--r-- 1 root root 366 Sep 30 08:02 valgrind.pc

那里不应该有一个python3.pc 文件吗?或者至少是一个特定的,比如python3.4.pc

还是我在这里做错了什么?

【问题讨论】:

  • 试试pkg-config --list-all | grep ^python
  • @falsetru 没有结果。不包括 grep ,这是一个相当短的列表,我也可以手动查看没有结果。我确实安装了 python 2 和 python 3,但什么也没安装。它们是通过apt-get 安装的。我的python3 --version 输出给了我:Python 3.4.3+

标签: python c makefile pkg-config


【解决方案1】:

要解决这个问题,我似乎需要获得python3-dev 包。

简单运行:

sudo apt-get install python3-dev

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-03
    • 1970-01-01
    • 2013-02-13
    • 2020-07-21
    • 2018-10-06
    • 2014-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多