![](/img/trans.png)
[英]Need help installing python package autopy on mac os x - difficulty with libpng and png.h
[英]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的步骤如下:
git clone git://github.com/msanders/autopy.git
#include <OpenGL/gl.h>
。 cd autopy
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的完整过程如下
sudo apt-get install libx11-dev
解决“#include”未找到错误 sudo apt-get install libxtst-dev
解决“#include”找不到错误 sudo apt-get install libpng-dev
解决“#include”未找到错误 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之前运行命令的安装版本,以及CD出autopy目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.