python - pip 安装 matplotlib : "no pkg-config"

标签 python macos matplotlib virtualenv pip

当我运行 pip install matplotlib(在 virtualenv 中)时,输出的第一行是:

Downloading/unpacking matplotlib
  Running setup.py egg_info for package matplotlib
    basedirlist is: ['/usr/local/', '/usr', '/usr/X11', '/opt/local']
    ============================================================================
    BUILDING MATPLOTLIB
                matplotlib: 1.2.0
                    python: 2.7.3 (default, Dec 14 2012, 13:31:05)  [GCC 4.2.1
                            (Apple Inc. build 5666) (dot 3)]
                  platform: darwin

    REQUIRED DEPENDENCIES
                     numpy: 1.6.2
                 freetype2: found, but unknown version (no pkg-config)

    OPTIONAL BACKEND DEPENDENCIES
                    libpng: found, but unknown version (no pkg-config)
                   Tkinter: Tkinter: 81008, Tk: 8.5, Tcl: 8.5
                      Gtk+: no
                            * Building for Gtk+ requires pygtk; you must be able
                            * to "import gtk" in your build/install environment
           Mac OS X native: yes
                        Qt: no
                       Qt4: no
                    PySide: no
                     Cairo: no
<snip>

注意

  1. “无 pkg-config”,以及
  2. 缺少的 Qt 库。

首先,与上面的输出相反,pkg-config 实际上安装在 PATH 上:

% pkg-config --version
0.27.1
% which pkg-config
/usr/local/bin/pkg-config

其次,qtfreetypelibpng 所在的目录相同:

% ls -l /usr/local/opt/{freetype,libpng,qt} | cut -c43-
/usr/local/opt/freetype -> ../Cellar/freetype/2.4.10/
/usr/local/opt/libpng -> ../Cellar/libpng/1.5.13/
/usr/local/opt/qt -> ../Cellar/qt/4.8.4/

我的问题分为三个部分:

  1. Where does pip install matplotlib get that basedirlist (3rd line of the output above)?
  2. What must I do differently so that pip install matplotlib will find pkg-config?
  3. What must I do differently so that pip install matplotlib will find qt?

最佳答案

在 Mac OS 上: 我使用 which pkg-config 检查安装。如果没有,使用 brew 安装,它可以工作:

brew install pkg-config

关于python - pip 安装 matplotlib : "no pkg-config",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13979916/

相关文章:

python - 使用 Python 生成报告 : PDF or HTML to PDF

python - 为什么 hash() 在 python3.4 和 python2.7 下比较慢

windows - 如何在同一实例中打开 VSCode 中的另一个文件夹?

c - 使用 fbo 和纹理的离屏渲染得到黑屏

python - 如何使用matplotlib定义相对于轴的ylabel位置?

python - 不添加不必要的极值的插值方法

python - 获取 numpy 二维数组中包含非屏蔽值的第一行和最后一行和列的索引

python - Pandas :生成并绘制平均值

macos - Mac 上的 wkhtmltopdf - 它是如何执行的?

python - 使用 hist2d 在 matplotlib 中创建对数线性图