AttributeError: module 'cv2' has no attribute 'face' (OpenCV and Python)









up vote
1
down vote

favorite












I have been trying a lot of things like reinstalling CV2, but this error will not go away.



This is the code:



import cv2
import numpy as np
from PIL import Image
import os

# Path for face image database
path = 'C:\Users\lordg_000\Desktop\trainer'

recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");'









share|improve this question























  • Which version of OpenCV are you using?
    – Employee
    Nov 11 at 12:07










  • the version is 3.4.3.18
    – Cactus882
    Nov 11 at 22:49














up vote
1
down vote

favorite












I have been trying a lot of things like reinstalling CV2, but this error will not go away.



This is the code:



import cv2
import numpy as np
from PIL import Image
import os

# Path for face image database
path = 'C:\Users\lordg_000\Desktop\trainer'

recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");'









share|improve this question























  • Which version of OpenCV are you using?
    – Employee
    Nov 11 at 12:07










  • the version is 3.4.3.18
    – Cactus882
    Nov 11 at 22:49












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have been trying a lot of things like reinstalling CV2, but this error will not go away.



This is the code:



import cv2
import numpy as np
from PIL import Image
import os

# Path for face image database
path = 'C:\Users\lordg_000\Desktop\trainer'

recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");'









share|improve this question















I have been trying a lot of things like reinstalling CV2, but this error will not go away.



This is the code:



import cv2
import numpy as np
from PIL import Image
import os

# Path for face image database
path = 'C:\Users\lordg_000\Desktop\trainer'

recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");'






python cv2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 6:24









Dave W. Smith

15.9k22430




15.9k22430










asked Nov 11 at 4:11









Cactus882

92




92











  • Which version of OpenCV are you using?
    – Employee
    Nov 11 at 12:07










  • the version is 3.4.3.18
    – Cactus882
    Nov 11 at 22:49
















  • Which version of OpenCV are you using?
    – Employee
    Nov 11 at 12:07










  • the version is 3.4.3.18
    – Cactus882
    Nov 11 at 22:49















Which version of OpenCV are you using?
– Employee
Nov 11 at 12:07




Which version of OpenCV are you using?
– Employee
Nov 11 at 12:07












the version is 3.4.3.18
– Cactus882
Nov 11 at 22:49




the version is 3.4.3.18
– Cactus882
Nov 11 at 22:49












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The extension module Opencv_contrib is not installed.



Solution:



pip uninstall opencv-python
pip install opencv-contrib-python





share|improve this answer






















  • it says Requirement already satisfied
    – Cactus882
    Nov 11 at 22:48










  • Uninstall before installing.
    – myhaspldeep
    Nov 12 at 11:12










  • you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
    – Sociopath
    Nov 12 at 11:23










  • None of the solutions here worked
    – Cactus882
    Nov 13 at 1:47










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245773%2fattributeerror-module-cv2-has-no-attribute-face-opencv-and-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













The extension module Opencv_contrib is not installed.



Solution:



pip uninstall opencv-python
pip install opencv-contrib-python





share|improve this answer






















  • it says Requirement already satisfied
    – Cactus882
    Nov 11 at 22:48










  • Uninstall before installing.
    – myhaspldeep
    Nov 12 at 11:12










  • you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
    – Sociopath
    Nov 12 at 11:23










  • None of the solutions here worked
    – Cactus882
    Nov 13 at 1:47














up vote
0
down vote













The extension module Opencv_contrib is not installed.



Solution:



pip uninstall opencv-python
pip install opencv-contrib-python





share|improve this answer






















  • it says Requirement already satisfied
    – Cactus882
    Nov 11 at 22:48










  • Uninstall before installing.
    – myhaspldeep
    Nov 12 at 11:12










  • you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
    – Sociopath
    Nov 12 at 11:23










  • None of the solutions here worked
    – Cactus882
    Nov 13 at 1:47












up vote
0
down vote










up vote
0
down vote









The extension module Opencv_contrib is not installed.



Solution:



pip uninstall opencv-python
pip install opencv-contrib-python





share|improve this answer














The extension module Opencv_contrib is not installed.



Solution:



pip uninstall opencv-python
pip install opencv-contrib-python






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 at 11:21

























answered Nov 11 at 12:35









myhaspldeep

16017




16017











  • it says Requirement already satisfied
    – Cactus882
    Nov 11 at 22:48










  • Uninstall before installing.
    – myhaspldeep
    Nov 12 at 11:12










  • you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
    – Sociopath
    Nov 12 at 11:23










  • None of the solutions here worked
    – Cactus882
    Nov 13 at 1:47
















  • it says Requirement already satisfied
    – Cactus882
    Nov 11 at 22:48










  • Uninstall before installing.
    – myhaspldeep
    Nov 12 at 11:12










  • you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
    – Sociopath
    Nov 12 at 11:23










  • None of the solutions here worked
    – Cactus882
    Nov 13 at 1:47















it says Requirement already satisfied
– Cactus882
Nov 11 at 22:48




it says Requirement already satisfied
– Cactus882
Nov 11 at 22:48












Uninstall before installing.
– myhaspldeep
Nov 12 at 11:12




Uninstall before installing.
– myhaspldeep
Nov 12 at 11:12












you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
– Sociopath
Nov 12 at 11:23




you don't need to uninstall opencv-python. Only pip install opencv-contrib-python should work for you.
– Sociopath
Nov 12 at 11:23












None of the solutions here worked
– Cactus882
Nov 13 at 1:47




None of the solutions here worked
– Cactus882
Nov 13 at 1:47

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245773%2fattributeerror-module-cv2-has-no-attribute-face-opencv-and-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto