/usr/local/include/tk.h:71:13:致命错误:安装python库时找不到'X11 / Xlib.h'文件

时间:2016-03-11 22:28:05

标签: python c++ matplotlib virtualenv

我有一个用于python的虚拟环境,并尝试在virtual-env中安装一些软件包:

sudo /Users/edamame/Library/python_virenv/bin/pip install matplotlib

然后我收到以下错误:

  :
  :
clang: warning: -framework Tcl: 'linker' input unused

clang: warning: -framework Tk: 'linker' input unused

In file included from src/_tkagg.cpp:28:

/usr/local/include/tk.h:71:13: fatal error: 'X11/Xlib.h' file not found

#   include <X11/Xlib.h>

            ^

1 error generated.

error: command 'cc' failed with exit status 1

我在Mac El-Captain,我有:

edamame$ locate Xlib.h
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

知道如何解决这个问题吗?谢谢!

1 个答案:

答案 0 :(得分:1)

您应该安装X11的开发文件(来自内存:libx11-dev),或者如果已经安装了它们,请将X11目录添加到包含搜索路径。

您可以使用std::*来确定文件是否已存在。使用locate Xlib.h编译器选项将目录添加到搜索路径中。

相关问题