pip install dlib 在 Anaconda 环境中不起作用
Posted
技术标签:
【中文标题】pip install dlib 在 Anaconda 环境中不起作用【英文标题】:pip install dlib not working in Anaconda environment 【发布时间】:2021-10-17 02:54:21 【问题描述】:我正在关注 tutorial,以使用以下 yml file 启动和运行 anaconda 环境。问题是,我始终只在这种环境中遇到错误。我已经尝试在 cmd 和 base (root)
Anaconda 环境中运行 pip install dlib
并且他们成功了。我为 Visual Studio Community 2019 安装了 CMake 和 C++ 构建工具。我不确定还能尝试什么,我还验证了我的环境变量中有我的 CMake bin 路径。知道我在这里缺少什么吗?
我在环境中使用 Python 3.7.3
ERROR: Complete output from command 'C:\Users\Breju\anaconda3\envs\stylegan2\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Breju\\AppData\\Local\\Temp\\pip-install-2pmurg4w\\dlib\\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\Breju\AppData\Local\Temp\pip-wheel-wemf8s5l' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\Breju\anaconda3\envs\stylegan2\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.29.30133.0
-- The CXX compiler identification is MSVC 19.29.30133.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/Breju/anaconda3/envs/stylegan2/python.exe (found version "3.7.3")
-- Found PythonLibs: C:/Users/Breju/anaconda3/envs/stylegan2/libs/Python37.lib
-- pybind11 v2.2.2
-- Using CMake version: 3.19.4
-- Compiling dlib version: 19.18.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Enabling AVX instructions
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- DID NOT FIND CUDA
-- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Breju/AppData/Local/Temp/pip-install-2pmurg4w/dlib/build/temp.win-amd64-3.7/Release
Invoking CMake build: 'cmake --build . --config Release -- /m'
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
Building Custom Rule C:/Users/Breju/AppData/Local/Temp/pip-install-2pmurg4w/dlib/dlib/CMakeLists.txt
base64_kernel_1.cpp
bigint_kernel_1.cpp
bigint_kernel_2.cpp
bit_stream_kernel_1.cpp
entropy_decoder_kernel_1.cpp
entropy_decoder_kernel_2.cpp
entropy_encoder_kernel_1.cpp
entropy_encoder_kernel_2.cpp
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_1.h(512,18): warning C4834: discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_1.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
md5_kernel_1.cpp
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_1.h(524,17): warning C4834: discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_1.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_2.h(537,18): warning C4834: discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_2.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_2.h(549,17): warning C4834: discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\bigint\bigint_kernel_2.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
tokenizer_kernel_1.cpp
unicode.cpp
image_dataset_metadata.cpp
mnist.cpp
global_function_search.cpp
kalman_filter.cpp
test_for_odr_violations.cpp
auto.cpp
sockets_kernel_1.cpp
bsp.cpp
dir_nav_kernel_1.cpp
dir_nav_kernel_2.cpp
dir_nav_extensions.cpp
linker_kernel_1.cpp
extra_logger_headers.cpp
logger_kernel_1.cpp
logger_config_file.cpp
misc_api_kernel_1.cpp
misc_api_kernel_2.cpp
sockets_extensions.cpp
sockets_kernel_2.cpp
sockstreambuf.cpp
sockstreambuf_unbuffered.cpp
server_kernel.cpp
server_iostream.cpp
server_http.cpp
multithreaded_object_extension.cpp
threaded_object_extension.cpp
threads_kernel_1.cpp
threads_kernel_2.cpp
threads_kernel_shared.cpp
thread_pool_extension.cpp
async.cpp
timer.cpp
stack_trace.cpp
cpu_dlib.cpp
tensor_tools.cpp
fonts.cpp
widgets.cpp
drawable.cpp
canvas_drawing.cpp
style.cpp
base_widgets.cpp
gui_core_kernel_1.cpp
gui_core_kernel_2.cpp
png_loader.cpp
save_png.cpp
jpeg_loader.cpp
save_jpeg.cpp
arm_init.c
filter_neon_intrinsics.c
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
jaricom.c
jcapimin.c
jcapistd.c
jcarith.c
jccoefct.c
jccolor.c
jcdctmgr.c
jchuff.c
jcinit.c
jcmainct.c
jcmarker.c
jcmaster.c
jcomapi.c
jcparam.c
jcprepct.c
jcsample.c
jdapimin.c
jdapistd.c
jdarith.c
jdatadst.c
jdatasrc.c
jdcoefct.c
jdcolor.c
jddctmgr.c
jdhuff.c
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jdatadst.c(185,60): warning C4267: '=': conversion from 'size_t' to 'unsigned long', possible loss of data [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
jdinput.c
jdmainct.c
jdmarker.c
jdmaster.c
jdmerge.c
jdpostct.c
jdsample.c
jerror.c
jfdctflt.c
jfdctfst.c
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jerror.c(193,5): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jerror.c(195,5): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
jfdctint.c
jidctflt.c
jidctfst.c
jidctint.c
jmemmgr.c
jmemnobs.c
jquant1.c
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(307,53): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(367,70): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(977,46): warning C4267: '-=': conversion from 'size_t' to 'long', possible loss of data [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
jquant2.c
jutils.c
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(991,46): warning C4267: '-=': conversion from 'size_t' to 'long', possible loss of data [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(1107,19): warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\dlib\external\libjpeg\jmemmgr.c(1110,11): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\dlib.vcxproj]
dlib.vcxproj -> C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_build\Release\dlib19.18.0_release_64bit_msvc1929.lib
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
Building Custom Rule C:/Users/Breju/AppData/Local/Temp/pip-install-2pmurg4w/dlib/tools/python/CMakeLists.txt
dlib.cpp
matrix.cpp
vector.cpp
svm_c_trainer.cpp
svm_rank_trainer.cpp
decision_functions.cpp
other.cpp
basic.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\vector.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\dlib.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\decision_functions.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\basic.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\svm_rank_trainer.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\other.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\svm_c_trainer.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
cca.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\matrix.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
sequence_segmenter.cpp
svm_struct.cpp
image.cpp
image2.cpp
image3.cpp
image4.cpp
rectangles.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\cca.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\sequence_segmenter.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\image2.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
object_detection.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\svm_struct.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\image.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\image4.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\image3.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\rectangles.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
shape_predictor.cpp
correlation_tracker.cpp
face_recognition.cpp
cnn_face_detector.cpp
global_optimization.cpp
image_dataset_metadata.cpp
numpy_returns.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\object_detection.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\shape_predictor.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\correlation_tracker.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\face_recognition.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\cnn_face_detector.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\global_optimization.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\image_dataset_metadata.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\numpy_returns.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
line.cpp
gui.cpp
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\line.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
C:\Users\Breju\anaconda3\Library\include\gif_lib.h(286,61): error C2734: 'GifAsciiTable8x8': 'const' object must be initialized if not 'extern' (compiling source file C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\tools\python\src\gui.cpp) [C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\build\temp.win-amd64-3.7\Release\dlib_python.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Breju\AppData\Local\Temp\pip-install-2pmurg4w\dlib\setup.py", line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "C:\Users\Breju\anaconda3\envs\stylegan2\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for dlib
【问题讨论】:
【参考方案1】:尝试通过在命令行中运行以下代码在 Anaconda 中创建一个新的虚拟环境
conda create --name opencv-env python=3.6
之后,激活环境
conda activate opencv-env
最后,运行以下命令安装 OpenCV 和其他重要包
pip install numpy scipy matplotlib scikit-learn (spyder/jupyter or whatever environment you are using)
pip install opencv-contrib-python
pip install dlib
如果之后您仍然收到要求您更新支持 C++11 的 Virtual Studio 的错误,请运行以下命令
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
【讨论】:
以上是关于pip install dlib 在 Anaconda 环境中不起作用的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu Python:无法 pip install dlib - dlib 构建轮失败,机器几乎卡住
Pip install dlib 卡在人脸识别 python 库中
pip install dlib 在 Anaconda 环境中不起作用
关于pip install dlib 出各种问题什么的。。。