Error to run a library to python
<p>I follow the steps according to <a href="http://npatta01.github.io/2015/08/10/dlib/" rel="nofollow">http://npatta01.github.io/2015/08/10/dlib/</a> but when I try to run (I use sudo),</p>

<pre><code>python python_examples/face_detector.py examples/faces/2007_007763.jpg
</code></pre>

<p>take back error.
Firstly, the error was</p>

<pre><code>AttributeError: 'module' object has no attribute 'image_window' 
</code></pre>

<p>to line 8.
Now, the error is <code>Illegal instruction (core dumped)</code> but I don't know why.
Please, help me to add the library correctly. </p>

<pre><code>import sys

import dlib
from skimage import io


detector = dlib.get_frontal_face_detector()
win = dlib.image_window()

for f in sys.argv[1:]:
    print("Processing file: {}".format(f))
    img = io.imread(f)
    # The 1 in the second argument indicates that we should upsample the image
    # 1 time.  This will make everything bigger and allow us to detect more
    # faces.
    dets = detector(img, 1)
    print("Number of faces detected: {}".format(len(dets)))
    for i, d in enumerate(dets):
        print("Detection {}: Left: {} Top: {} Right: {} Bottom: {}".format(
            i, d.left(), d.top(), d.right(), d.bottom()))

    win.clear_overlay()
    win.set_image(img)
    win.add_overlay(dets)
    dlib.hit_enter_to_continue()


# Finally, if you really want to you can ask the detector to tell you the score
# for each detection.  The score is bigger for more confident detections.
# The third argument to run is an optional adjustment to the detection threshold,
# where a negative value will return more detections and a positive value fewer.
# Also, the idx tells you which of the face sub-detectors matched.  This can be
# used to broadly identify faces in different orientations.
if (len(sys.argv[1:]) &gt; 0):
    img = io.imread(sys.argv[1])
    dets, scores, idx = detector.run(img, 1, -1)
    for i, d in enumerate(dets):
        print("Detection {}, score: {}, face_type:{}".format(
            d, scores[i], idx[i]))
</code></pre>

<p>As I see in your code:</p>

<pre><code>detector = dlib.get_frontal_face_detector()
win = dlib.image_window()
</code></pre>

<p>First line works and the second does not. This means that dlib is installed, but it is compiled with no GUI support</p>

<p><a href="https://github.com/davisking/dlib/blob/master/tools/python/src/gui.cpp#L1" rel="nofollow">In dlib's source code</a>  we see that if macro DLIB_NO_GUI_SUPPORT is defined - there will be no "image_window" function in dlib module. This macro is defined automatically if CMake scripts can't find X11 libraries</p>

<p>You need to ensure that dlib is compiled with GUI support. To make it, first - install  libx11-dev into your system if you are working on Linux, or XQuartz for Mac</p>

<p>When building dlib with running  <code>python setup.py install --yes DLIB_JPEG_SUPPORT</code> - check its messages. If there are errors or warnings - fix them</p>

python attributeerror dlib illegal-instruction