Stackoverflow/Python
[Python] you need to install visual studio for c++
The Neo
2021. 1. 9. 23:48
dlib를 설치하는 도중, 아래와 같은 에러가 발생하였음
C:\project>pip install dlib
Collecting dlib
Using cached dlib-19.21.1.tar.gz (3.6 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Anaconda3\envs\face\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Steel Stark\\AppData\\Local\\Temp\\pip-install-_32lpnsh\\dlib_7e7291004171407090278b42b72c2940\\setup.py'"'"'; __file__='"'"'C:\\Users\\Steel Stark\\AppData\\Local\\Temp\\pip-install-_32lpnsh\\dlib_7e7291004171407090278b42b72c2940\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Steel Stark\AppData\Local\Temp\pip-wheel-zsmcsun3'
cwd: C:\Users\Steel Stark\AppData\Local\Temp\pip-install-_32lpnsh\dlib_7e7291004171407090278b42b72c2940\
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.0 (default, Nov 6 2019, 16:00:02) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Steel Stark\AppData\Local\Temp\pip-install-_32lpnsh\dlib_7e7291004171407090278b42b72c2940\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Steel Stark\AppData\Local\Temp\pip-install-_32lpnsh\dlib_7e7291004171407090278b42b72c2940\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Anaconda3\envs\face\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Steel Stark\AppData\Local\Temp\pip-install-_32lpnsh\dlib_7e7291004171407090278b42b72c2940\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
이미 c 관련 라이브러리를 설치하였었는데 또 에러가 발생하여 당황스럽다 에러 메세지를 보니, cmake쪽에서 났으며, 결국 최신 버전인 2019 visual studio를 설치하기로 하였다.
visualstudio.microsoft.com/ko/downloads/
Visual C++ 빌드 도구를 선택하면 Default로 오른쪽 옵션들 5개가 선택되어 진다. 옵션을 보면, Windows용 C++ CMake 도구가 보인다. 무려 필요한 총 공간이 6.39GB로 CUDA와 비주얼 스튜디오 라이브러리만 설치해도 10기가 정도 잡아먹는 것 같다. (진짜 인공지능 개발자들은 하드공간 넉넉하게 준비하는게 좋을 듯)
(face) C:\Users\Stark>pip install dlib
Collecting dlib
Using cached dlib-19.21.1.tar.gz (3.6 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... done
Created wheel for dlib: filename=dlib-19.21.1-cp38-cp38-win_amd64.whl size=3000483 sha256=54948f3b1a52dd312ad7449f8eeac850af9386e9ea0c81b205902f3c88920a1f
Stored in directory: c:\users\steel stark\appdata\local\pip\cache\wheels\f0\05\00\752b02e4ab2f6ce4633c099c0666af48ff3e4627150a500282
Successfully built dlib
Installing collected packages: dlib
Successfully installed dlib-19.21.1
Visual Tool 설치 후, dlib를 성공적으로 설치된 것을 확인할 수 있다.
반응형