python:在ubuntu 16.04 web服务器上安装需求dlib错误



我正试图在Web服务器上安装人脸识别python api的需求,但它最后给了我错误,下面是的需求列表

certifi==2019.9.11
chardet==3.0.4
Click==7.0
cmake==3.15.3
dlib==19.18.0
face-recognition==1.2.3
face-recognition-models==0.3.0
Flask==1.1.1
Flask-Cors==3.0.8
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
numpy==1.17.2
opencv-python==4.1.1.26
Pillow==6.2.0
psycopg2==2.8.3
requests==2.22.0
six==1.12.0
urllib3==1.25.6
Werkzeug==0.16.0

我试过在本地运行它,它运行得很好,但当我试着在ubuntu Web服务器上运行它时,它在安装需求时出错了。下面是错误

ERROR: Command errored out with exit status 1:

Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-unk5_9mx/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-ins_file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lt8xrcl0/insle --install-headers /home/ubuntu/.local/include/python3.5m/dlib
cwd: /tmp/pip-install-unk5_9mx/dlib/
Complete output (222 lines):
running install
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.5.2 (default, Oct  7 2020, 17:19:02)
Invoking CMake setup: 'cmake /tmp/pip-install-unk5_9mx/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-unk5_9mx/dlib/build/lib.linux-x86_64
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3 (found version "3.5.2")
-- Found PythonLibs: python3.5m
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.2.2
-- Using CMake version: 3.15.3
-- Compiling dlib version: 19.18.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Enabling AVX instructions
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found system copy of libjpeg: /usr/lib/x86_64-linux-gnu/libjpeg.so
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- 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
-- Found LAPACK library
-- Found BLAS library
-- Looking for cblas_ddot
-- Looking for cblas_ddot - found
-- Looking for sgesv
-- Looking for sgesv - not found
-- Looking for sgesv_
-- Looking for sgesv_ - found
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: /tmp/pip-install-unk5_9mx/dlib/build/temp.linux-x86_64-3.5
Invoking CMake build: 'cmake --build . --config Release -- -j1'
Scanning dependencies of target dlib
[  0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o
[  1%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o
[  2%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.o
[  3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.o
[  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.o
[  5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o
[  5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o
[  6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.o
[  7%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.o
[  8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.o
[  9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.o
[ 10%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o
[ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.o
[ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.o
[ 12%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.o
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.o
[ 14%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.o
[ 15%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.o
[ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
[ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.o
[ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.o
[ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.o
[ 19%] Building CXX object dlib_build/CMakeFiles/dlib.dir/linker/linker_kernel_1.cpp.o
[ 20%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/extra_logger_headers.cpp.o
[ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_kernel_1.cpp.o
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_config_file.cpp.o
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_1.cpp.o
[ 23%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_2.cpp.o
[ 24%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_extensions.cpp.o
[ 25%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_2.cpp.o
[ 26%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf.cpp.o
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf_unbuffered.cpp.o
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_kernel.cpp.o
[ 28%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_iostream.cpp.o
[ 29%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_http.cpp.o
[ 30%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.o
[ 31%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.o
[ 32%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.o
[ 33%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.o
[ 33%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.o
[ 34%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.o
[ 35%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.o
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.o
[ 37%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.o
[ 38%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.o
[ 38%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.o
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.o
[ 41%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.o
[ 42%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.o
[ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.o
[ 44%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.o
[ 44%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.o
[ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.o
[ 46%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/arm/arm_init.c.o
[ 47%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/arm/filter_neon_intrinsics.c.o
[ 48%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/png.c.o
[ 49%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngerror.c.o
[ 50%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngget.c.o
[ 50%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngmem.c.o
[ 51%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngpread.c.o
[ 52%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngread.c.o
[ 53%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngrio.c.o
[ 54%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngrtran.c.o
[ 55%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngrutil.c.o
[ 55%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngset.c.o
[ 56%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngtrans.c.o
[ 57%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngwio.c.o
[ 58%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngwrite.c.o
[ 59%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngwtran.c.o
[ 60%] Building C object dlib_build/CMakeFiles/dlib.dir/external/libpng/pngwutil.c.o
[ 61%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/adler32.c.o
[ 61%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/compress.c.o
[ 62%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/crc32.c.o
[ 63%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/deflate.c.o
[ 64%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/gzclose.c.o
[ 65%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/gzlib.c.o
[ 66%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/gzread.c.o
[ 66%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/gzwrite.c.o
[ 67%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/infback.c.o
[ 68%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/inffast.c.o
[ 69%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/inflate.c.o
[ 70%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/inftrees.c.o
[ 71%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/trees.c.o
[ 72%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/uncompr.c.o
[ 72%] Building C object dlib_build/CMakeFiles/dlib.dir/external/zlib/zutil.c.o
[ 73%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.o
[ 74%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.o
[ 75%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.o
[ 76%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.o
[ 77%] Linking CXX static library libdlib.a
[ 77%] Built target dlib
Scanning dependencies of target dlib_python
[ 77%] Building CXX object CMakeFiles/dlib_python.dir/src/dlib.cpp.o
In file included from /tmp/pip-install-unk5_9mx/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-unk5_9mx/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-unk5_9mx/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-unk5_9mx/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-unk5_9mx/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-unk5_9mx/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-unk5_9mx/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-unk5_9mx/dlib/tools/python/src/dlib.cpp:4:
/tmp/pip-install-unk5_9mx/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:20: fatal error: Python.h: No such file or directory
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:62: recipe for target 'CMakeFiles/dlib_python.dir/src/dlib.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/dlib.cpp.o] Error 1
CMakeFiles/Makefile2:80: recipe for target 'CMakeFiles/dlib_python.dir/all' failed
make[1]: *** [CMakeFiles/dlib_python.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-unk5_9mx/dlib/setup.py", line 261, in <module>
'Topic :: Software Development',
File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
self.run_command('build')
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.5/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-unk5_9mx/dlib/setup.py", line 135, in run
self.build_extension(ext)
File "/tmp/pip-install-unk5_9mx/dlib/setup.py", line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j1']' returned non-zero exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-unk5_9mx/dlib/setup.pytokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --re-managed --user --prefix= --compile --install-headers /home/ubuntu/.local/include/python3.5m/dlib Check the logs for full command output.

我的环境详细信息供参考:

python 3.7&ubuntu 16.04


1(分配根权限并更新ubuntu第一个

sudo su
apt-get update

2(检查您的版本&python的路径&pip。

which python3
python3 -V
which pip3
pip3 -V

3(

pip3 install cmake

4(

apt-get install -y --fix-missing 
build-essential 
cmake 
gfortran 
git 
wget 
curl 
grapgicsmagick 
libgraphicsmagic-dev 
libatlas-dev 
libavcodec-dev 
libavformat-dev 
libgtk2.0-dev 
libjpeg-dev 
liblapack-dev 
libswscale-dev 
pkg-config 
software-properties-common 
zip

6(

apt-get install python3-dev

5(

pip3 install dlib

✅完成

然后安装requirement.txt并从中删除dlib

相关内容

  • 没有找到相关文章

最新更新