Problem
After running pip install dlib to install the dlib library, I found I couldn’t run ⬇️
dlib.image_window()
The script will throw this error:
AttributeError: module 'dlib' has no attribute 'image_window'
Solution
After several researching, I tried to solve it by:
-
uninstall the
dlib: If you are using pip to install it, you could directly runpip uninstall dlib -
Clone
dlibgit repo to local:git clone https://github.com/davisking/dlib -
Run
dlibsetup.py:python setup.py install -
Try to check setup log, if it shows any
GUIerror, fix the error first. I’m having ⬇️ error, then I tried to download theXQuartz.
*****************************************************************************
*** DLIB GUI SUPPORT DISABLED BECAUSE X11 DEVELOPMENT LIBRARIES NOT FOUND ***
*** Make sure XQuartz is installed if you want GUI support. ***
*** You can download XQuartz from: https://www.xquartz.org/ ***
*****************************************************************************
-
uninstall the
dlibfrom pip:pip uninstall dlib -
install the
dlibagain:pip install dlib -
Run dlib python test file:
python python_examples/face_detector.py examples/faces/2007_007763.jpg -
If it shows the
RuntimeError, it means we need toturn on XQuartzwhen running the script,XQuartzis just like an app, open it will be okay ~
RuntimeError: Failed to initialize X11 resources
All of error should disappear now. 🎉

Comments
Join the discussion for this article at here . Our comments is using Github Issues. All of posted comments will display at this page instantly.