Eric,会点编程 2023-09-13 23:20 采纳率: 0%
浏览 27

如何在inscode里面,python环境安装dlib库无法安装?

在inscode里面,python环境安装dlib库无法安装


```python
~/Python pip install dlib
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting dlib
  Using cached http://mirrors.aliyun.com/pypi/packages/2e/9d/4e1003c044bdb07f7c0d83ae87d694e10e5a6c296b84566aa9a6ec9eed2a/dlib-19.24.2.tar.gz (11.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [250 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Building extension for Python 3.9.16 (main, Dec  7 2022, 01:11:51)
      Invoking CMake setup: 'cmake /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/build/lib.linux-x86_64-cpython-39 -DPYTHON_EXECUTABLE=/usr/bin/python3.9 -DCMAKE_BUILD_TYPE=Release'
      -- The C compiler identification is GNU 9.4.0
      -- The CXX compiler identification is GNU 9.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - 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: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMake Deprecation Warning at /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/external/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.
      
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
      
      
      -- pybind11 v2.10.0
      CMake Warning (dev) at /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.
      
      Call Stack (most recent call first):
        /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
        /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/external/pybind11/tools/pybind11Common.cmake:180 (include)
        /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/external/pybind11/CMakeLists.txt:200 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.
      
      -- Found PythonInterp: /usr/bin/python3.9 (found suitable version "3.9.16", minimum required is "3.6")
      -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.9.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Using CMake version: 3.27.4
      -- Compiling dlib version: 19.24.2
      -- SSE4 instructions can be executed by the host processor.
      -- AVX instructions can be executed by the host processor.
      -- Enabling AVX instructions
      -- 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;/usr/lib/x86_64-linux-gnu/libXext.so
      -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.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
      -- Looking for IceConnectionNumber in ICE
      -- Looking for IceConnectionNumber in ICE - found
      -- Found system copy of libpng: /usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so
      -- Searching for BLAS and LAPACK
      -- Searching for BLAS and LAPACK
      -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
      -- Checking for module 'cblas'
      --   No package 'cblas' found
      -- Checking for module 'lapack'
      --   No package 'lapack' found
      -- Looking for cblas_ddot
      -- Looking for cblas_ddot - not found
      -- 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
       *****************************************************************************
       *** No BLAS library found so using dlib's built in BLAS.  However, if you ***
       *** install an optimized BLAS such as OpenBLAS or the Intel MKL your code ***
       *** will run faster.  On Ubuntu you can install OpenBLAS by executing:    ***
       ***    sudo apt-get install libopenblas-dev liblapack-dev                 ***
       *** Or you can easily install OpenBLAS from source by downloading the     ***
       *** source tar file from http://www.openblas.net, extracting it, and      ***
       *** running:                                                              ***
       ***    make; sudo make install                                            ***
       *****************************************************************************
      CMake Warning (dev) at /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/dlib/CMakeLists.txt:628 (find_package):
        Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
        --help-policy CMP0146" for policy details.  Use the cmake_policy command to
        set the policy and suppress this warning.
      
      This warning is for project developers.  Use -Wno-dev to suppress it.
      
      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")
      -- Found CUDA, but CMake was unable to find the cuBLAS libraries that should be part of every basic CUDA install. Your CUDA install is somehow broken or incomplete. Since cuBLAS is required for dlib to use CUDA we won't use CUDA.
      -- DID NOT FIND CUDA
      -- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
      -- Searching for FFMPEG/LIBAV
      -- Checking for modules 'libavdevice;libavfilter;libavformat;libavcodec;libswresample;libswscale;libavutil'
      --   No package 'libavdevice' found
      --   No package 'libavfilter' found
      --   No package 'libavformat' found
      --   No package 'libavcodec' found
      --   No package 'libswresample' found
      --   No package 'libswscale' found
      --   No package 'libavutil' found
       *****************************************************************************
       *** No FFMPEG/LIBAV libraries found.                                      ***
       *** On Ubuntu you can install them by executing                           ***
       ***    sudo apt install libavdevice-dev libavfilter-dev libavformat-dev   ***
       ***    sudo apt install libavcodec-dev libswresample-dev libswscale-dev   ***
       ***    sudo apt install libavutil-dev                                     ***
       *****************************************************************************
      -- Configuring done (2.8s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/pip-install-gkz654ly/dlib_751426c3df8d4d88b1d9c8df8664344f/build/temp.linux-x86_64-cpython-39
      Invoking CMake build: 'cmake --build . --config Release -- -j16'
      [  1%] 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
      [  3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o
      [  3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o
      [  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o
      [  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o
      [  5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_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
      [  7%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.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/test_for_odr_violations.cpp.o
      [ 10%] Building CXX object dlib_build/CMakeFiles/dlib.dir/fft/fft.cpp.o
      [ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.o
      [ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
      [ 12%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.o
      [ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.o
      [ 14%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.o
      [ 14%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o
      [ 15%] Building CXX object dlib_build/CMakeFiles/dlib.dir/linker/linker_kernel_1.cpp.o
      [ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/extra_logger_headers.cpp.o
      [ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_kernel_1.cpp.o
      [ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_config_file.cpp.o
      [ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_1.cpp.o
      [ 19%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_2.cpp.o
      [ 20%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_extensions.cpp.o
      [ 20%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_2.cpp.o
      [ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/     File "/tmp/pip-build-env-pfafyk7q/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-pfafyk7q/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-pfafyk7q/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 130, in run
        File "<string>", line 170, in build_extension
        File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j16']' returned non-zero exit status 2.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

```

  • 写回答

1条回答 默认 最新

  • 专家-赤兔[在线] 全栈领域优质创作者 2023-09-13 23:39
    关注

    引用 皆我百晓生 小程序回复内容作答:

    对于在Inscode中安装dlib库时遇到无法安装的问题,是因为缺少一些依赖项或存在操作系统限制。可以尝试以下方法解决该问题:

    1. 确保系统的一些依赖库已经安装,例如OpenBLAS、libavdevice等。可以使用以下命令安装它们:
    sudo apt-get install libopenblas-dev liblapack-dev
    sudo apt-get install libavdevice-dev libavfilter-dev libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev
    
    1. 检查Python环境是否正确配置。确保Python版本为3.6以上,并且PIP工具已经正确安装。

    2. 确保使用的是Python虚拟环境(Virtual Environment),这有助于隔离不同项目的依赖库。

    3. 如果仍然无法安装dlib,可以尝试使用以下命令将dlib从源代码进行构建和安装:

    git clone https://github.com/davisking/dlib.git
    cd dlib
    python setup.py install
    

    这将从GitHub上克隆dlib的源代码,并使用Python的setup.py文件进行构建和安装。

    1. 如果以上方法仍然无法解决问题,可能是由于操作系统限制导致的。可以尝试在本地开发环境或其他操作系统中安装dlib来验证是否存在操作系统限制。

    总之,尝试上述方法来解决在Inscode中安装dlib库的问题。如果问题仍然存在,建议查阅相关文档或在开发者社区中查找类似的问题和解决方案。

    评论

报告相同问题?

问题事件

  • 创建了问题 9月13日

悬赏问题

  • ¥15 网络分析设施点无法识别
  • ¥15 状态图的并发态问题咨询
  • ¥15 PFC3D,plot
  • ¥15 VAE模型编程报错无法解决
  • ¥100 基于SVM的信息粒化时序回归预测,有偿求解!
  • ¥15 物体组批优化问题-数学建模求解答
  • ¥15 微信原生小程序tabBar编译报错
  • ¥350 麦克风声源定位坐标不准
  • ¥15 apifox与swagger使用
  • ¥15 egg异步请求返回404的问题