Windows 10上的dlib安装 [英] dlib installation on Windows 10
问题描述
我想将 dlib
与python一起用于图像识别。我的python应用程序在Windows 10上可以很好地与OpenCV一起运行,但是当我想从 cmd
安装 dlib
时,它给我以下错误:
错误:找不到cmake,请确保它已安装并在路径中。
可以按照https://cmake.org/install/
中的说明安装cmake。您还可以使用--cmake参数指定其路径。
我该怎么办?
< a href = https://i.stack.imgur.com/3DsdV.png rel = noreferrer>
从.whl安装Dlib
Dlib 19.7.0
pip安装https://pypi.python。 org / packages / da / 06 / bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e / dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5 = b7330a5b2d46420343fbed5dff $ e $ b $ c $ b $ c $ b $ c $ b $ c $ b $ c $ b $ c $ b $ c $ b $ c $ b $ c $ b code b $ b 您可以进行测试,可以从网站上下载示例,例如 SVM_Binary_Classifier.py 并在计算机上运行它。
注意:如果出现此消息,则必须从源代码构建dlib >:
dlib-19.7.0-cp36-cp36m-win_amd64.whl在t上不受支持他的平台
从源代码安装Dlib(如果上述解决方案无效)
Windows Dlib > 19.7.0
- 下载并安装CMake安装程序: https://cmake.org/download/
-
将CMake可执行路径添加到环境变量中:
set PATH =% PATH%; C:\Program Files\CMake\bin
note :可执行文件可能与 C:\Program Files\CMake\bin
不同,只需相应地设置PATH。
注释:该路径将被临时设置,要使更改永久生效,您必须在高级系统设置→环境变量 标签。
-
重新启动Cm d或PowerShell窗口,以使更改生效。
- 从Python软件包索引中下载Dlib源(.tar.gz): https://pypi.org/project/dlib/#files 解压缩并进入文件夹。
-
检查Python版本: python -V
。这是我的输出: Python 3.7.2
,所以我正在为Python3.x安装它,而为不是安装Python2.x
note :如果您为不同的二进制文件设置了不同的变量,则可以为Python 2和Python 3安装它,例如: python2- V
, python3 -V
-
运行安装: python setup.py install
Linux Dlib 19.17.0
sudo apt-get安装cmake
wget https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
tar -xvzf dlib -19.17.0.tar.gz
cd dlib-19.17.0 /
sudo python3 setup.py install
note :要为Python 2.x安装Dlib,请使用 python
代替 python3
,您可以通过 python -V $ c $检查python版本c>
I want to use dlib
with python for image recognition. I have the python app running great with OpenCV on Windows 10, but when I want to install dlib
from the cmd
it gives me this following error :
error: Cannot find cmake, ensure it is installed and in the path. You
can install cmake using the instructions at https://cmake.org/install/
You can also specify its path with --cmake parameter.
What should I do?
解决方案 Install Dlib from .whl
Dlib 19.7.0
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
You can test it, downloading an example from the site, for example SVM_Binary_Classifier.py and running it on your machine.
Note: if this message occurs you have to build dlib from source:
dlib-19.7.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform
Install Dlib from source (If the solution above doesn't work)
Windows Dlib > 19.7.0
- Download the CMake installer and install it: https://cmake.org/download/
Add CMake executable path to the Enviroment Variables:
set PATH="%PATH%;C:\Program Files\CMake\bin"
note: The path of the executable could be different from C:\Program Files\CMake\bin
, just set the PATH accordingly.
note: The path will be set temporarily, to make the change permanent you have to set it in the "Advanced system settings" → "Environment Variables" tab.
Restart The Cmd or PowerShell window for changes to take effect.
- Download the Dlib source(.tar.gz) from the Python Package Index : https://pypi.org/project/dlib/#files extract it and enter into the folder.
Check the Python version: python -V
. This is my output: Python 3.7.2
so I'm installing it for Python3.x and not for Python2.x
note: You can install it for both Python 2 and Python 3, if you have set different variables for different binaries i.e: python2 -V
, python3 -V
Run the installation: python setup.py install
Linux Dlib 19.17.0
sudo apt-get install cmake
wget https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
tar -xvzf dlib-19.17.0.tar.gz
cd dlib-19.17.0/
sudo python3 setup.py install
note: To install Dlib for Python 2.x use python
instead of python3
you can check your python version via python -V
这篇关于Windows 10上的dlib安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!