ImportError: No module named 'dlib'
Asked Answered
S

8

8

I followed the step how to install dlib python on Windows and it works on CMD but in Python's IDE it said ImportError: No module named 'dlib'

Scibert answered 16/10, 2018 at 6:52 Comment(4)
Hi Instead of posting an image of text, please can you copy the text directly and paste it as a code block, This will help other StackOverflow users search for other text that might also be useful. ThanksKape
I think you installed dlib for python 3.6 and now you are trying to run a python 3.5 script.Gastritis
Can be sure that if you open CDM in a folder other than the Dlib directory you can import it?Rosin
why this is so hard to install this dlib I am sick and tried of trying to install thisHoberthobey
J
16

Follow these steps

Install CMAKE

pip install cmake

Then Install dlib

pip install dlib
Justify answered 26/5, 2020 at 19:51 Comment(0)
E
7

There are 3 important steps to make it work.

  1. Install Cmake Cmake download Link and add Path environment variable to its bin eg: C:/ProgramFiles/cmake/bin

  2. Download Visual Studio Built Tools which will be around 4.56 GB Visual Studio Built Tools Link

  3. Then use cmd to install dlib using

pip install dlib

This will do the job....

E answered 12/5, 2020 at 5:54 Comment(0)
H
3

Do you tried to do a simple

pip install dlib

I think it can be useful!

In windows, you have to launch a cmd in admin Windows > CMD > Right - Click > Run as Administrator > Yes

Hilliary answered 18/10, 2018 at 18:51 Comment(0)
I
0

You have multiple pythons, one Python 3.5 and one Python 3.6.

You installed this library in one python only, not in the other.

The library can be imported only in those pythons that you installed it in, not in any other pythons.

You need to install the library in the other python too, if you want to use it there.

Type py -0 in a terminal to get a list of available python versions (that the Python Launcher knows of).

You can also use where python (windows builtin command) to get a list of all the python executables that can be found through the PATH environment variable.

Then you can use py -3.5 -m pip install dlib to install the library into that python. Or, if you know the path to that specific python (let's say C:\Python35\python.exe), you can call that python directly: C:\Python35\python.exe -m pip install dlib

Impanel answered 7/8, 2022 at 11:20 Comment(0)
J
0

Step1:

brew install cmake

Step2:

brew install dlib
Justino answered 14/5 at 14:41 Comment(0)
C
-1

In ubantu 16.04 > Terminal> put these commands

sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip
mkvirtualenv dlib_test -p python3
workon cv
pip install numpy
pip install dlib
Carbonado answered 3/12, 2019 at 11:21 Comment(1)
Can't you condense the install steps this down to one line? sudo apt-get install build-essential cmake libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev python python-dev python-pip python3 python3-dev python3-pipThermosiphon
L
-1

For Window's users:

  1. Download Visual Studio Built Tools link : https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. Open Command Prompt - run as Administrator

type and enter the command :- pip install dlib

  1. Open the corresponding virtual anaconda environment and install face-recognition package

pip install face-recognition

Liken answered 8/9, 2020 at 13:23 Comment(0)
F
-2

Any time you’re working on a Python project that uses external dependencies that you’re installing with pip, it’s best to first create a virtual environment:

follow the bellow link for best understanding: https://realpython.com/python-virtual-environments-a-primer/#create-it

once you create a virtual environment run your all pip commands over there you can easily install all libraries without any error. Thanks!!

Fluorescence answered 7/8, 2022 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.