dlib安装python 2.7

Posted

技术标签:

【中文标题】dlib安装python 2.7【英文标题】:Dlib installation python 2.7 【发布时间】:2017-06-27 00:23:52 【问题描述】:

这里的前海军咕噜声! python和编码的新手。尝试为 python 2.7 安装 DLIB。我运行命令pip install dlib 并不断收到此错误消息:

Collecting dlib
  Using cached dlib-19.1.0.tar.gz 
Building wheels for collected packages: dlib
  Running setup.py bdist_wheel for dlib ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pickfl~1\\appdata\\local\\temp\\pip-build-4qhao2\\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\pickfl~1\appdata\local\temp\tmpcvgy9jpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  Detected Python architecture: 32bit
  Detected platform: win32
  Configuring cmake ...
  -- Building for: NMake Makefiles
  -- The C compiler identification is unknown
  -- The CXX compiler identification is unknown
  CMake Error in CMakeLists.txt:
    The CMAKE_C_COMPILER:
      cl
    is not a full path and was not found in the PATH.
    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).
    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.
  CMake Error in CMakeLists.txt:
    The CMAKE_CXX_COMPILER:
      cl
    is not a full path and was not found in the PATH.
    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).
    Tell CMake where to find the compiler by setting either the environment
    variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
    to the compiler, or to the compiler name if it is in the PATH.
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/Pickflickr1/AppData/Local/Temp/pip-build-4qhao2/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/Pickflickr1/AppData/Local/Temp/pip-build-4qhao2/dlib/tools/python/build/CMakeFiles/CMakeError.log".
  error: cmake configuration failed!

  ----------------------------------------   Failed building wheel for dlib

Along with this:
 Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pickfl~1\\appdata\\local\\temp\\pip-build-4qhao2\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record c:\users\pickfl~1\appdata\local\temp\pip-l8pcsq-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in c:\users\pickfl~1\appdata\local\temp\pip-build-4qhao2\dlib\

任何反馈或帮助都会很棒!前罐头,请多多包涵,谢谢。

【问题讨论】:

你的电脑上安装了visual studio吗? 你找到解决办法了吗? ***.com/questions/54967887/… 【参考方案1】:

试试这个:

conda install -c menpo dlib=18.18

【讨论】:

不错!但不需要指定版本,conda install -c menpo dlib【参考方案2】:

首先安装 dlib 库的所有依赖项:->

sudo apt-get install python-dev python-pip

sudo apt-get install build-essential cmake pkg-config

sudo apt-get install libx11-dev libatlas-base-dev

sudo apt-get install libgtk-3-dev libboost-python-dev

然后执行

pip install dlib

享受计算机视觉.....

“搜索的很多未来都将与图片有关。计算机视觉技术将大有作为”

本·西尔伯曼

【讨论】:

【参考方案3】:

首先你需要安装 pip。然后您可以从“https://pypi.python.org/pypi/dlib/18.17.100”网站下载 dlib python 2.7 版本,您将获得 dlib 的***。然后使用正常程序,如 pip install 'path to dlib wheel'。

例如。如果您已将 .whl 文件保存到下载文件夹,然后键入 pip install C:\Users\XYZ\Downloads\dlib-18.17.100-cp27-none-win32.whl。

这肯定会奏效。当我尝试时,我没有收到任何错误,并且 dlib 已成功安装。

干杯

【讨论】:

谢谢,它对我有用!我在 Windows 7 32 位上使用 Python 2.7。【参考方案4】:

pip 包可能已损坏或未更新。不管怎样,从https://github.com/davisking/dlib.git下载dlib_master

之后有一个简单的 python 安装指南。转到包含 setup.py 的文件夹,然后打开终端或其他任何内容并键入 sudo python setup.py install.

【讨论】:

以上是关于dlib安装python 2.7的主要内容,如果未能解决你的问题,请参考以下文章

linux下安装python dlib依赖

python机器学习模块安装

dlib库,怎么在python中安装

python pip 安装dlib一直失败?

为 python 安装 Dlib 库时出错

如何提高python下的dlib人脸检测速度