file-type

Dlib与pip在Windows和Linux的安装教程

下载需积分: 50 | 88.91MB | 更新于2024-11-30 | 152 浏览量 | 0 下载量 举报 收藏
download 立即下载
在Windows和Ubuntu系统中安装Dlib库时,可以使用预编译的whl文件(Wheel Package),这是一种Python包的分发格式,旨在使安装过程更加简便快捷。以下是关于如何在Windows和Ubuntu系统中安装Dlib的详细步骤和知识点: ### Windows系统中安装Dlib 1. **安装最新pip3** - 在命令提示符中输入以下命令安装pip3: ```python python3 get-pip.py ``` - 这一步骤确保你拥有最新版本的pip3,它是一个Python包管理工具,用于安装、卸载和管理Python包。 2. **安装Dlib** - 打开Anaconda提示符,并使用pip3安装预编译的dlib库: ```python pip3 install dlib-19.1.0-cp35-cp35m-win_amd64.whl ``` - 这里的`dlib-19.1.0-cp35-cp35m-win_amd64.whl`是一个whl文件,适用于Python 3.5和Windows系统,其中`cp35`代表Python版本,`cp35m`指的是与Python 3.5版本的CPython解释器兼容的二进制标记,`win_amd64`指的是适用于64位Windows系统的二进制文件。 ### Ubuntu系统中安装Dlib 1. **从源代码构建安装Dlib** - 通过git克隆Dlib的源代码仓库: ```bash git clone *** ``` - 进入克隆的源代码目录: ```bash cd dlib ``` - 使用Python3运行设置脚本以安装Dlib: ```bash python3 setup.py install ``` - 这种方法不依赖于whl文件,而是从源代码开始编译安装,可能会花费更多时间,但可以确保库完全兼容当前系统环境。 ### 安装OpenCV库 OpenCV是一个开源的计算机视觉和机器学习软件库,Dlib和OpenCV常被一起用于图像处理和机器学习项目。以下是安装OpenCV的命令: - **针对Python 3.5安装OpenCV** ```bash pip3 install opencv_python-*.*.*.**-cp35-cp35m-manylinux1_x86_64.whl ``` - **针对Python 3.7安装OpenCV** ```bash pip3 install opencv_python-*.*.*.**-cp37-cp37m-manylinux1_x86_64.whl ``` - 这些whl文件适用于不同版本的Python,`cp37`对应Python 3.7版本,`manylinux1`表示二进制文件兼容多数Linux发行版的x86_64架构。 ### 知识点总结 - **Dlib库**:是一个高级机器学习算法的实现,用于生物识别和对象检测等任务,广泛应用于计算机视觉和图像处理领域。 - **pip工具**:是Python的包管理工具,用于安装、更新和删除Python包。 - **Anaconda**:是一个开源的Python和R语言分发平台,包含了大量的数据科学包和环境管理工具。 - **whl文件**:Python包的分发格式,它是一个预先编译好的分发包,使得安装过程更为简单快速,尤其适用于没有编译环境或希望快速部署的应用场景。 - **Git版本控制**:一个开源的分布式版本控制系统,用于追踪代码变更和协作开发。 - **OpenCV库**:是计算机视觉和机器学习领域的强大库,包含丰富的图像处理函数和算法。 在处理Dlib和OpenCV库的安装时,应该注意选择与系统架构和Python版本相匹配的whl文件或源代码版本,以确保库的正常运行和最佳性能。

相关推荐

filetype

Collecting face_recognition Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB) Requirement already satisfied: Pillow in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (9.4.0) Requirement already satisfied: face-recognition-models>=0.3.0 in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (0.3.0) Collecting dlib>=19.7 Using cached dlib-19.24.1.tar.gz (3.2 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: Click>=6.0 in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (8.1.3) Requirement already satisfied: numpy in d:\anaconda\envs\pytorch\lib\site-packages (from face_recognition) (1.24.2) Requirement already satisfied: colorama in d:\anaconda\envs\pytorch\lib\site-packages (from Click>=6.0->face_recognition) (0.4.6) Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [7 lines of output] running bdist_wheel running build running build_py running build_ext ERROR: CMake must be installed to build dlib [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib, face_recognition Running setup.py install for dlib ... error error: subprocess-exited-with-error × Running setup.py install for dlib did not run successfully. │ exit code: 1 ╰─> [9 lines of output] running install D:\anaconda\envs\pytorch\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py running build_ext ERROR: CMake must be installed to build dlib [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> dlib note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

NinglingPan
  • 粉丝: 31
上传资源 快速赚钱