繁体   English   中英

我已经安装了libpng,但是有一个错误“&#39;png.h&#39;文件找不到#include <png.h> “当我安装autopy时

[英]I have already installed libpng, but there is an error “ 'png.h' file not found #include <png.h>” when I am installing the autopy

我是python的初学者,最近我想在我的Mac上安装autopy(Mavericks,10.9.4)。 我阅读了很多介绍和其他人的问题。 但我仍然无法成功安装autopy。 我安装autopy的步骤如下:

  1. 我已经从http://ethan.tira-thompson.com/Mac_OS_X_Ports.html安装了libpng
  2. 我是初学者,我检查/ Library / Frameworks和/ usr / local我觉得我已经正确安装了libpng
  3. [终端] git clone git://github.com/msanders/autopy.git
  4. 根据介绍,我在autopy文件“src / screengrab.c”的第七行写了#include <OpenGL/gl.h>
  5. [终端] cd autopy
  6. [终端] python setup.py build

这里有命令窗口

src/png_io.c:3:10: fatal error: 'png.h' file not found
#include <png.h>
          ^
1 error generated.
error: command 'cc' failed with exit status 1

我是否需要在png_io.c中重写“png.h”的文件地址?我该如何在Mac上安装autopy?我有一些重要的遗漏吗?

尝试:

sudo apt-get install libpng-dev

我现在正在安装autopy,并坚持同样的步骤。 安装libpng-dev后,问题解决了。 :)

安装autopy的完整过程如下

  1. sudo apt-get install libx11-dev解决“#include”未找到错误
  2. sudo apt-get install libxtst-dev解决“#include”找不到错误
  3. sudo apt-get install libpng-dev解决“#include”未找到错误
  4. easy_install autopy

每次我尝试安装autopy时都会遇到此问题。 正如Evert在他对你的问题的评论中提到的,你的编译器找不到libpng 如果您通过您提到的链接正确安装了它,那么您可以添加一些环境变量来帮助您的编译器找到它,而无需编辑源代码。

这是一个完整的例子,适用于OS X Yosemite(10.10.1):

git clone git://github.com/msanders/autopy.git
cd autopy
export LIBRARY_PATH="/usr/local/lib:/usr/local/include/libpng"
export C_INCLUDE_PATH="/usr/local/lib:/usr/local/include/libpng"
python setup.py build
sudo python setup.py install

在我确认png.h处于默认路径之后

/usr/local/include/png.h

我运行以下命令强制这些路径作为构建的默认标志

sudo CPPFLAGS='-I/usr/local/include/' LDFLAGS='-L/usr/local/lib/' python setup.py build

它工作(在OS X约塞米蒂10.10.5)

记住尝试使用AutoPy之前运行命令的安装版本,以及CDautopy目录

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM