python安装dlib遇到的错误:AttributeError:module ‘dlib’ has no attribute ‘get_frontal_face_detector’问题解决

dlib是一个非常好用的跨平台的通用库,但是在安装过程中遇到了许多问题,我在使用Anaconda安装dlib过程中,用pip install 安装,安装成功后,import没有问题

如下图,import cv2没有报错。
在这里插入图片描述
但是在pycharm使用里面的函数时出现错误AttributeError: module ‘dlib’ has no attribute ‘get_frontal_face_detecetor’
在这里插入图片描述
找了好久都没找到原因,后来才发现是因为文件名的问题。自己建立的文件名和使用的模块重名了。
在这里插入图片描述
以后得注意,不能犯这种低级错误了。
将文件名dlib.py更改为learn.py,再次运行,就不会报错啦。