로컬에 python face-recognition 설치

potato·2021년 7월 31일
0

파이썬

목록 보기
11/14

우선 conda는 설치가 되어있어야 함
설치한 적이 없다면.. 이전 블로그나 다른 사이트 참조

1. 패키지 설치는 환경이 꼬일 수 있으니 가상환경내에서 수행

# 가상환경 활성화
conda activate flask-env
(flask-env)

2. conda로 관련 라이브러리(face_recognition_models) 설치

(flask-env) > conda install -y numpy pillow opencv scipy cmake conda-forge dlib akode face_recognition_models
conda install -y numpy pillow opencv scipy cmake conda-forge dlib akode face_recognition_models
...

뭐가 좀 나옴..

Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - conda-forge
  - face_recognition_models
  - akode

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

정상적으로 설치 안된것으로 보여짐 ( PackagesNotFoundError ) 아마도 이유는..

  • 정상적인 repository를 못찾았거나..
  • 의존성 관련된 패키지를 설치하지 못해서..

3. 의존성을 무시하고 pip로 설치하도록 옵션 변경

# 참조한 블로그에서도 설치실패시 아래와 같이 시도하라고 추천
(flask-env) > pip install --no-dependencies face_recognition
Collecting face_recognition
  Downloading face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Installing collected packages: face-recognition
Successfully installed face-recognition-1.3.0
  • 깔끔하게 설치됨

4. 설치 확인

(flask-env) > python

import PIL
import face_recognition

Please install `face_recognition_models` with this command before using `face_recognition`:

pip install git+https://github.com/ageitgey/face_recognition_models


정상적으로 설치하려면 저렇게 다시 설치하라고 안내해줌.. ;;

##### 5. git 주소를 추가해서 다시 설치

(flask-env) > pip install git+https://github.com/ageitgey/face_recognition_models
Collecting
git+https://github.com/ageitgey/face_recognition_models
Cloning https://github.com/ageitgey/face_recognition_models to c:\users\chaeumcni\appdata\local\temp\pip-req-build-3jtfxl2y
Running command git clone -q https://github.com/ageitgey/face_recognition_models 'C:\Users\chaeumcni\AppData\Local\Temp\pip-req-build-3jtfxl2y'
Resolved https://github.com/ageitgey/face_recognition_models to commit e67de717267507d1e9246de95692eb8be736ab61
Building wheels for collected packages: face-recognition-models
Building wheel for face-recognition-models (setup.py) ... done
Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566221 sha256=1502c461585bccdd7ee118bd2c6e329383ba28176665d9882cd01b1d806b865a
Stored in directory: C:\Users\chaeumcni\AppData\Local\Temp\pip-ephem-wheel-cache-x7q6ipxr\wheels\d9\6a\72\3d597dfe6668bdc025ede4cafcecbafd851b27e73c44ab5aa9
Successfully built face-recognition-models
Installing collected packages: face-recognition-models
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
face-recognition 1.3.0 requires Click>=6.0, which is not installed.
Successfully installed face-recognition-models-0.3.0



#### 6. 설치 다시 확인

(flask-env) > python

import PIL
import face_recognition

오! 드디어 face_recognition을 로컬 PC에서 사용할 수 있다.

출처: https://headbreakz.tistory.com/entry/IT-python-face-recognition-설치-방법 [Head vs breakz]

profile
안녕하세요~

0개의 댓글