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

user3894516 picture user3894516 · Jul 31, 2014 · Viewed 14.2k times · Source

I am a beginner at python, recently I want to install autopy in my Mac (Mavericks,10.9.4). I read many introductions and other people's questions. But I still cannot install the autopy successfully. My steps to install the autopy are as below:

  1. I have installed the libpng from the http://ethan.tira-thompson.com/Mac_OS_X_Ports.html
  2. I am beginner, I check the /Library/Frameworks and /usr/local and I think I have installed the libpng correctly
  3. [Terminal]git clone git://github.com/msanders/autopy.git
  4. According to the introduction, I write #include <OpenGL/gl.h> at the seventh line of the autopy file "src/screengrab.c"
  5. [Terminal]cd autopy
  6. [Terminal]python setup.py build

And here comes in the command window

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

Do I need to rewrite the file address of "png.h" in the png_io.c?And what should I do to install the autopy on Mac?Do I have some important Omissions?

Answer

user4508551 picture user4508551 · Jan 29, 2015

Try:

sudo apt-get install libpng-dev

I am installing autopy right now, and stuck at the same step. And after installing libpng-dev, the problem resolved. :)

The full process to install autopy is as follow

  1. sudo apt-get install libx11-dev to resolve "#include " not found error
  2. sudo apt-get install libxtst-dev to resolve "#include " not found error
  3. sudo apt-get install libpng-dev to resolve "#include " not found error
  4. easy_install autopy