ubuntu16.04如何安装dlib
来源:互联网 发布:办公软件繁体版 编辑:程序博客网 时间:2024/06/05 04:36
Step 1: Install OS libraries
/sudo apt-get install build-essential cmake pkg-configsudo apt-get install libatlas-base-dev libboost-python-dev/
/cd dlib-19.6/
cd dlibmkdir buildcd buildcmake ..cmake --build . --config Releasesudo make installsudo ldconfigcd ../
上述是本人编译的步骤。
链接:
1、How to install dlib for python3 in Ubuntu 14.04
2、How to install dlib
3、Install Dlib on Ubuntu(good)
附:链接3的文章
In this post, we will provide step by step instructions on how to install Dlib on Ubuntu.
Step 1: Install OS libraries
/sudo apt-get install build-essential cmake pkg-configsudo apt-get install libx11-dev libatlas-base-devsudo apt-get install libgtk-3-dev libboost-python-dev/
/sudo apt-get install python-dev python-pip python3-dev python3-pipsudo -H pip2 install -U pip numpysudo -H pip3 install -U pip numpy/
/# Install virtual environmentsudo pip2 install virtualenv virtualenvwrappersudo pip3 install virtualenv virtualenvwrapperecho"# Virtual Environment Wrapper" >> ~/.bashrcecho"source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrcsource~/.bashrc ############ For Python 2 ############# create virtual environmentmkvirtualenv facecourse-py2 -p python2workon facecourse-py2 # now install python libraries within this virtual environmentpip install numpy scipy matplotlib scikit-image scikit-learn ipython # quit virtual environmentdeactivate###################################### ############ For Python 3 ############# create virtual environmentmkvirtualenv facecourse-py3 -p python3workon facecourse-py3 # now install python libraries within this virtual environmentpipinstallnumpy scipy matplotlib scikit-image scikit-learn ipython # quit virtual environmentdeactivate######################################/
Step 3: Compile DLib
Step 3.1: Compile C++ binary
Davis King, creator of Dlib, recommends using CMake for using Dlib in your code.
But if you want to use Dlib as a library follow these steps:
/wget http://dlib.net/files/dlib-19.6.tar.bz2tarxvf dlib-19.6.tar.bz2cd dlib-19.6/mkdir buildcd buildcmake ..cmake --build . --config Releasesudo make installsudo ldconfigcd../
Now you can use pkg-config to provide path to Dlib’s include directory and link Dlib library file.
/pkg-config --libs --cflags dlib-1/
Step 3.2: Compile Python module
Activate Python virtual environment.
/############ For Python 2 ############workon facecourse-py2 ############ For Python 3 ############workon facecourse-py3/
Now let’s compile and install Dlib’s Python module.
/# move to dlib's root directorycd dlib-19.6python setup.py install# clean up(this step is required if you want to build dlib for both Python2 and Python3)rm -rf distrm -rf tool/python/buildrm python_examples/dlib.so/
We have cleaned up few files and directories because Dlib creates Python modules for Python2 and Python3 with the same name. Suppose you ran the setup.py in Python2 virtual environment, it will generate dlib.so in python_examples directory. Now if you deactivate Python2 virtual env, activate Python3 virtual env and run setup.py file, it will replace dlib.so (which was compiled with Python2) in python_examples directory with newer one (which is compiled with Python3). When you will try to run any python_example from within this directory, it will import this dlib.so instead of one located in site-packages or dist-packages directory and throw an error. Although this error won’t occur is a local copy of dlib.so is not present in current directory but it is better to remove local copies to avoid any confusion.
For consistency, we have installed Python and C++ binaries of Dlib using the same source code.
If you are going to use only Python module of Dlib you can also install Python bindings for Dlib using pip.
/pip install dlib/
Now you can exit from Python virtual environment.
/deactivate/
Now, whenever you are going to run Python scripts which use Dlib you have to activate the virtual environment using workon command.
Subscribe & Download Code
If you liked this article and would like to download code (C++ and Python) and example images used in all posts of this blog, please subscribe to our newsletter. You will also receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.
Subscribe Now
- Stephen Meschke
- Behnam Zeinali
- Vaibhaw Singh Chandel
- Behnam Zeinali
- ubuntu16.04如何安装dlib
- Ubuntu16.04 安装dlib face_recognition
- ubuntu16.04环境用pip3安装dlib
- ubuntu16.04编译dlib for Android
- Ubuntu16.04如何安装kaldi
- ubuntu16.04如何安装php5?
- 【dlib】Dlib编译安装
- Ubuntu16.04+Anaconda环境下dlib库无法导入解决方法
- Ubuntu16.04如何安装和使用shadowsocks
- ubuntu16.04如何安装搜狗输入法
- 如何安装ubuntu16.04到u盘
- ubuntu16.04如何安装下载工具uget+aria2
- 如何在ubuntu16.04上安装jdk
- ubuntu16.04如何安装搜狗输入法
- ubuntu16.04如何升级/安装beignet1.3
- 如何在Ubuntu16.04上安装Rstudio
- ubuntu16.04英文环境下如何安装搜狗拼音
- Ubuntu16.04如何安装Hadoop2.6.0(单机伪分布方式)
- leetcode 432. All O`one Data Structure
- Reinforcement Learning_By David Silver笔记八: Integrating Learning and Planning
- SPI通信协议(SPI总线)
- 阿里巴巴Java开发手册学习小结5-并发处理
- 12.11作业(代码)
- ubuntu16.04如何安装dlib
- 在 usb linux下格式化磁盘
- ZStack重新定义混合云
- mac 用VMware安装windwods报错
- python3和opencv
- TensorFlow读取CSV数据的实现
- rxjava2的disposable
- logback与flume集成
- 创建一个本地管理的表空间之AUTOALLOCATE和UNIFORM