How to install Dlib for Python 3 on Windows

In this video we will see how to install the Dlib library for Python 3 on Windows.

In this specific tutorial we are going to install Dlib 19.8 for Python 3.6 (64 bit version). We choosed this specific version as it’s the latest one (March 2019 the moment I’m writing this post) which has ready binaries for windows.
In other words is the one that is really easy to install.

In this website you find all the binaries available at the moment:
https://pypi.org/simple/dlib/

If you don’t have Python and Opencv installed yet, go first with Python and Opencv installation following this tutorial.

Install Dlib for Python 3.6:

  1. Python 3.6 (64 bit) has to be already installed.
  2. Run Windows Prompt Command. You can type on the search bar “CMD”.

    Remember to click with right button of the mouse and then “Run it as administrator”, otherwise you might not have the permission to install the library.
  3. Type on the prompt command:
  4. Once you see the message “Successfully installed dlib“, it means that the installation has been completed.

You can now run Python, try importing the dlib library. If you don’t get any error, it means that the installation was done correctly.

Hi there, I’m the founder of Pysource.
I help Companies, Freelancers and Students to learn easily and efficiently how to apply visual recognition to their projects.
For Consulting/Contracting Services, check out this page.

Источник



How to install dlib library for Python in Windows 10

Sasiwut Chaiyadecha

Hi! This is my first blog (or article depending on what you call) in English. Anyway, I am writing this blog because I have been facing with the trouble of this package for a while. I was trying to google it for the solution but I could not find the alternative one. So! this is my solution to install dlib library in Windows 10.

Some people might say that why don’t you just use conda install which is already complied. It is much easy to install. Well… I agree and I could do it. However, other packages, such as face_recognition could not leverage dlib when you used conda install . Hence, we need to use pip install .

Preparation

First thing first, there are two things required (really need it indeed!).

  • CMake: This is because dlib was developed in C based programming language, so it needs this program to use it. It can be found in the link https://cmake.org/download/. To make sure matching with your operation system, in our case is Windows 10 64-bit version.

how to install dlib in windows 10 for python

  • Visual studio: As I mentioned before, dlib is C based programming language. Another thing that really need is compiler. The Visual studio can be downloaded in the link https://visualstudio.microsoft.com/visual-cpp-build-tools/. After finishing the installation, you need to install additional packages for C, C++ programming, which is Packages CMake tools for Windows

Sometimes we need manage the Windows PATH environment for CMake. (If you already added during installation, you can skip this section).

For checking whether the PATH already added or not, you can go to Environment Variables on Windows by go to This PC > Properties > Advance system settings. Then, go to Tab Advanced and click on Environment Variables.

Another windows will pop-up and click Edit…

how to install dlib in windows 10 for python

If you are unable to find CMake path, you should add the CMake installed directory like image below.

how to install dlib in windows 10 for python

Install

Everything is looking good so far. Now we can install dlib into our python environment. First of all, you need to install CMake library.

Кроме этого:  4 Установка Windows 7 8212 сам процесс 8230

Then, you can install dlib library using pip install .

After passing enter, you laptop or desktop will run the C, C++ Compiler. If you got something like image below, you would be fine.

how to install dlib ติดตั้ง dlib windows 10

After these all, you will get dilb installed on your Windows 10 by not using conda install compiler.

For further discussion or anyone would like to contact me. We could do it over the LinkdIn below.

Источник

установка dlib на Windows 10

Я хочу использовать dlib с python для распознавания изображений. У меня есть приложение python, отлично работающее с OpenCV в Windows 10, но когда я хочу установить dlib из cmd он дает мне следующую ошибку:

Ошибка: не удается найти cmake, убедиться, что он установлен и находится на пути. Вы можете установить cmake, используя инструкции на https://cmake.org/install/. Вы также можете указать свой путь с параметром —cmake.

Изображение 48109

9 ответов

Установите Dlib из.whl

Dlib 19.7.0

Вы можете протестировать его, загрузив пример с сайта, например SVM_Binary_Classifier.py и запустив его на своем компьютере.

Установить Dlib из источника

Dlib > 19.7.0

  1. Загрузите источник (.tar.gz) из индекса пакета Python: https://pypi.python.org/pypi/dlib
  2. Запустите setup.py: sudo python setup.py install (Linux) или python setup.py install (Windows)

Примечание. Эта процедура предполагает, что у вас установлен CMake.

Следуй этим шагам:

  • pip install cmake
  • Установите инструменты сборки Visual Studio отсюда.
  • В Visual Studio 2017 перейдите на вкладку Отдельные компоненты, Инструменты Visual C++ для Cmake и установите флажок в разделе «Компиляторы, инструменты сборки и среды выполнения».
  • pip install dlib

Вам нужно установить Cmake.

dlib — это c++ libary с привязками python. Сначала его нужно построить. Я предполагаю, что это произойдет автоматически, как только вы установили Cmake

Выберите dlib.whl файл в соответствии с установленной версией python. Например, если установлена версия python 3.6.7, 64-битная система или если python равен 3.5.0 32 бит, выберите dlib-19.5. 1- cp36 -cp36m-win_ amd64.whl и dlib-18.17. 100- cp35 -none — win32.whl соответственно.

Полужирный текст говорит о поддерживаемой версией python.

Загрузите здесь файл с колесом или скопируйте адрес ссылки

для вышеописанного метода.whl файл должен находиться в рабочем каталоге

Ниже ссылка для python3.6, поддерживающая ссылку dlib, для python 3.5 u можно заменить ссылкой dlib 35.whl

Вы должны установить cmake, как сообщила вам ошибка.

или непосредственно установить cmake отсюда https://cmake.org/download/

Как только CMake установлен, установите pLL dlib.

У меня были встроенные инструменты vstudio, и я сделал свой тест.

Вы можете использовать vcpkg для установки dlib.

Если у вас нет vcpkg, вы можете получить его здесь (Читать Quick Start)

После того, как вы получили vcpkg, запустите:

Просто быстрая информация о том, что сработало для меня (два года спустя). Дэвис Кинг предоставил мне два способа добавления последней версии python dlib (19.17.0) в любую среду python в Windows 10. Обратите внимание, что я запускаю несколько конфигураций Linux в Oracle VirtualBox, но Windows 10 — это моя родная ОС, которая имеет доступ к графическому процессору Nvidia, поэтому мне нужно установить ее на Windows 10. (Невозможно получить доступ к графическому процессору — легко — через VirtualBox).

Первый — самый простой:

И тогда его можно легко построить из источников. Загрузите с https://pypi.org/simple/dlib/ и следуйте инструкциям на http://dlib.net/compile.html.

Также только что нашли другой способ доступа с помощью Visual Studio 2019 (или 2017). Используйте vcpkg — см. Ссылку https://vcpkg.readthedocs.io/en/latest/

Я собрал dlib 19.17 на Windows 10 с CMake, и он работал нормально, но потом я нашел vcpkg, и теперь библиотеки dlib являются неотъемлемой частью Visual Studio. Мне больше не нужно добавлять все внешние ссылки на C++ и компоновщик. Версия в vcpkg в настоящее время 19.16-1, и она построена с полной поддержкой CUDA.

Кроме этого:  Евро трак установка модов

Источник

dlib installation on Windows 10

I want to use dlib with python for image recognition. I have the python app running great with OpenCV on Windows 10, but when I want to install dlib from the cmd it gives me this following error :

What should I do?

My command prompt error

18 Answers 18

Install Dlib from .whl

Dlib 19.7.0

You can test it, downloading an example from the site, for example SVM_Binary_Classifier.py and running it on your machine.

Note: if this message occurs you have to build dlib from source:

dlib-19.7.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform

Install Dlib from source (If the solution above doesn’t work)

Windows Dlib > 19.7.0

    Download the CMake installer and install it: https://cmake.org/download/

Add CMake executable path to the Enviroment Variables:

set PATH=»%PATH%;C:\Program Files\CMake\bin»

note: The path of the executable could be different from C:\Program Files\CMake\bin , just set the PATH accordingly.

note: The path will be set temporarily, to make the change permanent you have to set it in the “Advanced system settings” → “Environment Variables” tab.

Restart The Cmd or PowerShell window for changes to take effect.

Check the Python version: python -V . This is my output: Python 3.7.2 so I’m installing it for Python3.x and not for Python2.x

note: You can install it for both Python 2 and Python 3, if you have set different variables for different binaries i.e: python2 -V , python3 -V

Run the installation: python setup.py install

Linux Dlib 19.17.0

note: To install Dlib for Python 2.x use python instead of python3 you can check your python version via python -V

Follow these steps:

  • pip install cmake
  • Install Visual Studio build tools from here.
  • In Visual Studio 2017 go to the Individual Components tab, Visual C++ Tools for Cmake, and check the checkbox under the «Compilers, build tools and runtimes» section.
  • pip install dlib

Effective till now(2020).

You need to install Cmake.

dlib is an c++ libary with python bindings. It needs to be builded first. My guess is this will happen automatically once you have installed Cmake

As you can see many answers above, But i would like to post a quick solution which works for sure in Anaconda3. I haven’t chosen Visual Studio as it consumes lot of memory.

Please follow the below steps.

Note you can find few other dlib packages, but the above one will works perfectly with this procedure.

dlib will be successfully installed.

If you are using Anaconda Prompt (recommended),

Or you can use the approach mentioned below:

Download Python 3.6.8 and install, make sure you add it to PATH.

Install NumPy, scipy, matplotlib and pandas in your pc/laptop with this command in command prompt:-

Источник

Install Dlib on Windows

Install Dlib on Windows

In this post, we will provide step by step instructions on how to install Dlib on Windows.

Compiling Python modules such as NumPy, SciPy etc. is a tedious task. Anaconda is a great Python distribution which comes with a lot of pre-compiled Python packages. So we will use Anaconda as our Python distribution.

An alternative to Anaconda is that you install official Python library and use Christoph Gohlke’s awesome repository to install pre-compiled Python modules.

This tutorial is based on using Anaconda so we may not be able to help if you choose to use Gohlke’s precompiled binaries or if you compile Python libraries from source.

If you intend to use Dlib only in C++ projects, you can skip Python installation part.

Кроме этого:  Большое разрешение экрана гостевой Windows на VirtualBox

Now let’s go through the steps to install Dlib. Follow our previous post Install OpenCV3 on Windows to complete Step 1, 2 and 3.

Step 1: Install Visual Studio 2015

Step 2: Install CMake v3.8.2

Step 3: Install Anaconda 3

Step 4: Download Dlib

Step 5: Build Dlib library

Extract this compressed file. Open Windows PowerShell or Command Prompt and move to the directory where you have extracted this file.

If you are running these commands on Command Prompt replace ` (backtick) with ^ (caret).

Dlib will be installed within dlib-19.6\build\install directory. We will use CMake to build Dlib examples but you can use Visual Studio too. This directory (dlib-19.6\build\install) contains include and library folders which you can specify in Visual Studio to build projects using Dlib.

Step 6: Update user environment variable – dlib_DIR

This environment variable is needed for CMake to find out where Dlib is installed. CMake looks for a file named dlibConfig.cmake within directory dlib_DIR to find Dlib’s include and library directories.

  1. Press Windows Super key, search for “environment variables”.
    Search System Environment Variables from Windows search menu
  2. Click Environment Variables in System Properties window.
    Edit Environment Variables
  3. Click New in “User Variables” (in upper half of window).
  4. Under variable name write dlib_DIR and under variable value write full path to directory dlib-19.6\build\install\lib\cmake\dlib
    On my machine path is: D:\programming\dlib-19.6\build\install\lib\cmake\dlib
    This directory contains file “dlibConfig.cmake”. This is used by CMake to configure dlib_LIBS and dlib_INCLUDE_DIRS variables to generate project files. Before assigning the value to variable dlib_DIR make sure that this path has file dlibConfig.cmake.
  5. Now click ok to save and close environment variables window.

Note: If you have an open Command Prompt/Power Shell window before these values were updated, you have to close and open a new Command Prompt/Power Shell window again.

Step 7: Build Dlib examples

We will use our CMakeLists.txt file instead of one which is shipped with Dlib.
Download modified CMakeLists.txt file and put it in dlib-19.6\examples directory and replace the default one with this one. Then follow the steps given below:

Once build is complete, it will generate executables for all examples in examples\build\Release folder.

Step 8: Test Dlib’s C++ example

We will test Face Landmark Detection demo to check whether we have installed Dlib correctly.
Download trained model of facial landmarks from Dlib’s website. Extract this file (shape_predictor_68_face_landmarks.dat.bz2) to Dlib’s root directory (dlib-19.6).

Step 9: Install Dlib’s Python module (Only Anaconda 3)

Compiling Python bindings for Dlib from source is non-trivial. You have to compile Boost.Python from scratch and configure some environment variables (such as BOOST_ROOT and BOOST_LIBRARYDIR) before you can compile Python module of Dlib. We are skipping that part for now. A complete tutorial on how to build Dlib Python bindings from source will be released in future.

To save time and efforts it is suggested to use Anaconda 3. You can install a compiled binary of dlib v19.4 from Anaconda. At the time this article was updated Dlib’s latest available version on Anaconda’s conda-forge repository is 19.4. So we will install v19.4 instead of 19.6

Step 10: Test Dlib’s Python example

Subscribe & Download Code

If you liked this article and would like to download code (C++ and Python) and example images used in this post, please click here. Alternately, sign up to receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.

Источник