23

We are trying to install PIL and getting the error

error: command 'gcc' failed with exit status 1

Many similar questions, including this one (installing Reportlab (error: command 'gcc' failed with exit status 1 )), suggest installing the python-dev package.

Where can this be sourced for Windows 7. pip install python-dev didn't work.

Community
  • 1
  • 1
user1328021
  • 9,110
  • 14
  • 47
  • 78

3 Answers3

20

It seems there is no python-dev package for Windows. But the Python installer for Windows will normally install a sub directory include inside the main Python dir.

So with Python in C:\Python you would get:

  • C:\Python
  • C:\Python\DLLs
  • C:\Python\Doc
  • C:\Python\include
  • C:\Python\Lib
  • C:\Python\libs
  • C:\Python\Scripts
  • C:\Python\tcl
  • C:\Python\Tools

Inside this include directory you will find Python.h, which can be included or referenced.

ᴠɪɴᴄᴇɴᴛ
  • 1,613
  • 2
  • 21
  • 28
  • I am able to include Python.h, but I have no pyconfig.h. So I am getting `Python-2.7.13\Include/Python.h:8:22: fatal error: pyconfig.h: No such file or directory` – Meet Taraviya Jun 05 '17 at 10:22
  • @MeetTaraviya I’m afraid you’ll have to make that a separate question, because I haven’t done much Python development since answering … don’t remember having needed `pyconfig.h`. Maybe https://stackoverflow.com/a/28678231/1548776 is a good hint? – ᴠɪɴᴄᴇɴᴛ Jun 06 '17 at 21:15
  • @MeetTaraviya Also have a look at https://svn.python.org/projects/python/trunk/PC/pyconfig.h. https://github.com/esa/pagmo/wiki/Guide-to-Compilation-on-Windows-x64#patch-python-pyconfigh suggests `pyconfig.h` *is* included … – ᴠɪɴᴄᴇɴᴛ Jun 06 '17 at 21:19
  • @MeetTaraviya Good to hear you were able to solve it. Would you please explain briefly for the benefit of others with the same problem? – ᴠɪɴᴄᴇɴᴛ Jun 07 '17 at 13:43
  • 1
    I founnd out python-config on the system, ran `python-config --ldflags` and added those flags to linking option – Meet Taraviya Jun 07 '17 at 13:57
3

When I used to develop on Windows, this website with pre-compiled binaries was extremely handy: http://www.lfd.uci.edu/~gohlke/pythonlibs/

You'll find pre-compiled versions of PIL and ReportLab there. Hope that helps you out.

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144
2

The easiest way to get a complete working setup on Windows, including ming compiler, is to install a distribution such as pythonxy (my favorite) or EDP.

Charles Brunet
  • 21,797
  • 24
  • 83
  • 124