LoginSignup
0
1

More than 3 years have passed since last update.

【dlib】AttributeError: module 'dlib' has no attribute ... とエラーがでたら

Posted at

エラー概要

先日、dlibを使って顔特徴点を検出しようとしたらこんなエラーに遭遇しました

Traceback (most recent call last):
  File "dlib.py", line 33, in <module>
    detector = dlib.get_frontal_face_detector()
AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'

dlibをimportはできているのできちんと環境構築はできているようでしたが、実際dlibを使おうとするとなるとAttributeErrorが吐かれていました。

解決方法

いろいろ調べてみるとこちらのstackoverflowに解決方法が書かれていました。

Rename your file from dlib.py to something else, say dlib_project.py.

どうやらファイル名がdlib.pyとなっていることが問題だったようです。
試しにgetFacialLandmarks.pyとファイル名を変更したら無事に動きました。
ライブラリ名と同じファイル名はつけないほうがいいみたいですね…

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1