setup.py install for dlib: finished with status 'error'

别说谁变了你拦得住时间么 提交于 2021-01-28 03:30:08

问题


I'm having problems installing Adam Geitgey's face_recognition library on my Windows PC.

I followed this tutorial for installing dlib with Python bindings on windows and I've successfully installed the requirements listed there.

However, trying to install dlib with pip throws the error

setup.py install for dlib: finished with status 'error'

How can I go about resolving this?


回答1:


In order for dlib (with its Python bindings) to work well for you on Windows, you need to use a Python installation whose version is 3.6 or lower.

I understand you're using the latest version of Python. If I'm correct in my assumption that you're working with Python 3.8, then you'll have to follow these steps:

  • Install Python 3.6 on your PC — take note of the installation path as you'll need this for creating the appropriate virtual environment.

  • Create a Python 3.6 virtual environment — this will serve to isolate the dependencies of your current project. Assuming your Python 3.6 was installed to C:\Users\Mfonism\AppData\Local\Programs\Python\Python36 (like it was on my PC :)), you'll create your virtual environment thusly (from your project directory):

    c:\> C:\Users\Mfonism\AppData\Local\Programs\Python\Python36\python.exe -m venv env36
    
    • venv is the Python virtual environment module.

    • env36 is the name of the virtual environment you're creating.

  • Activate the so-created virtual environment.

    c:\>  env36\Scripts\activate
    

    The name of the virtual environment (env36) should now appear in the terminal.


UPDATE: IGNORE THIS BLOCK

  • Install your project dependencies with pip.

    pip install face_recognition
    

    If this fails, use the --no-cache-dir option to circumvent cached versions of the dependencies.

    pip install face_recognition --no-cache-dir
    

UPDATE: DO THIS INSTEAD

You will need to install specific versions of dlib and face_recognition. And you will need to install dlib first, or face_recognition will try to install the latest version of it, and this will fail.

So:

  • Install dlib 19.8.1

    pip install dlib==19.8.1
    
  • Then install face_recognition 1.2.2

    pip install face_recognition==1.2.2
    


来源:https://stackoverflow.com/questions/60090433/setup-py-install-for-dlib-finished-with-status-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!