ubuntu 14 python?linux python安装

Ubuntu安装Odoo

说个坑,需要先进root账户。否则会有创建不了相关文档及位置的提示报错。

wget

tar-zxf Python-3.9.0.tgz

cd Python-3.9.0

./configure--prefix=/usr/local/python3

./configure--enable-optimizations

Step 1: Update Server

Step 2: Create Odoo User in Ubuntu

Step 3: Install PostgreSQL Server

Step 4: Create Odoo user for postgreSQL

Step 5: Install Python Dependencies

Step 6: Install Python PIP Dependencies

Step 7: Install other required packages

Step 8: Install Wkhtmltopdf

Step 9: Create Log directory

Step 10:Install Odoo

Step 11: Setting permissions on home folder

Step 12: Create server config file

Step 13: Install other Dependencies

Step 14:创建一个 Systemd Unit文件

打开你的文本编辑器,并且在/etc/systemd/system/目录下创建一个名为odoo.service的文件,将下面的内容粘贴到文件中:

保存文件并且关闭编辑器。

设置该文件的权限

通知 Systemd有一个新的 unit文件:

Step 15: Now Start Odoo

通过执行下面命令启用并且启动 Odoo服务:

或者直接执行以下命令

你可以通过下面的命令检查服务状态:

想要查看 Odoo服务日志,使用下面的命令:

打开你的浏览器,输入:

假设所有安装完成,你将会看到下面这样的屏幕:

如果你无法访问这个页面,那很可能是你的防火墙阻止了端口8069。请在宝塔面板(或通过防火墙命令)放行端口8069,云服务器上防火墙策略也应放行。

将 Nginx配置成 SSL代理服务器

默认的 Odoo网站服务器通过 HTTP服务。想要使 Odoo部署更安全,我们将会配置 Nginx作为 SSL代理服务器,使网站服务器通过 HTTPS进行服务。

SSL代理服务器是一个用来处理 SSL加密解密的代理服务器。这意味着,Nginx将会处理并且解密进来的 TLS连接(HTTPS),并且传递未被加密的请求到内部服务(Odoo)。在 Nginx和 Odoo之间的流量将不会被加密。

使用一个反向代理服务器有很多好处,比如负载均衡,SSL,缓存,压缩,静态内容服务,等等。

确保你满足下面的前提条件,再继续下一步的安装配置:

一个指向你的服务器的公网 IP的域名,我们使用example.com。

安装 Nginx

域名的 SSL证书。你可以安装一个免费的 Encrypt SSL证书。

打开你的文本编辑器,创建或者编辑域名服务器配置块:

下面的配置将会建立 SSL,HTTP转向 HTTPS,WWW转向 non-www,缓存静态文件,并且开启 GZip压缩。

不要忘记使用你自己的 Odoo域名替换 example.com并且设置正确的 SSL证书地址。

一旦你完成了,重启 Nginx和Odoo服务:

此时,反向代理服务器配置好了,你可以通过 来访问 Odoo了。

改变监听端口

这一步是可选的,但是它是一个很好的实践操作。

默认情况下,Odoo服务监听所有网络接口的8069端口。想要禁止对 Odoo的直接访问,你可以封锁8069端口,并且强制 Odoo只监听本地监控。

我们将会配置 Odoo仅仅监听 127.0.0.1。打开配置文件,添加下面的内容到文件最后面:/etc/odoo13.conf

保存配置文件,并且重启 Odoo服务器,使修改生效:

如果日志出现以下错误

「connect() failed(111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server:, request:"POST/longpolling/poll HTTP/1.1", upstream:" ", host:"XX.XX.XX.XX", referrer:" "」

解决:

Let's just say you have a longpolling parameter in your odoo-server.conf

and set

after starting your odoo, just runs$ sudo netstat-tulpn to ensure that your longpolling is running, and you'll get this info:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:8072 0.0.0.0:* LISTEN 10121/python3

tcp 0 0 0.0.0.0:8069 0.0.0.0:* LISTEN 10119/python3

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1461/sshd

...

when you can't find your longpolling there(that's why Bad Gateway Occurs, nginx can not find the running longpolling port), maybe just need to install gevent first:

and restart your odoo.

check$ sudo netstat-tulpn again, and you'll see that your longpolling port already running..

启用多进程

默认情况下,Odoo工作在多线程模式。对于产品级别的部署,我们推荐修改成多进程服务器,提升稳定性,并且充分利用系统资源。

想要启用多进程,你需要编辑 Odoo配置文件,并且设置一个非 0的工作进程数字。工作进程数字,基于系统中的 CPU核心数字和可用的 RAM内存来计算。

通过 Odoo官方文档计算工作进程的数量以及需要的 RAM内存大小,你可以使用下面的公式:

工作进程数量计算:

工作进程最大数量理论值=(system_cpus* 2)+ 1

1个工作进程可以服务约等于 6个并行客户。

Cron进程也需要 CPU

RAM内存大小计算

我们考虑 20%的请求是重请求,并且 80%的请求是轻量级请求。重量级请求使用将近 1GB RAM,而轻量级请求使用将近 150MB RAM。

需要的 RAM= number_of_workers*((light_worker_ratio* light_worker_ram_estimation)+(heavy_worker_ratio* heavy_worker_ram_estimation))

如果你不知道你的系统有多少 CPU,你可以使用下面的grep命令:

比方说,你有一个系统,拥有 4核心 CPU,8GB RAM内存,和 30个并行 Odoo用户。

30 users/ 6= 5(5是所需要的理论工作进程数量)

(4* 2)+ 1= 9(9是理论的最大工作进程数量)

基于上面的计算,你可以使用 5个进程+1个进程(Cron进程)总共 6个进程。

基于工作进程,计算 RAM内存:

RAM= 6*((0.8 150)+(0.2 1024))~= 2 GB of RAM

计算结果显示,Odoo安装将会需要大概 2GB内存。

想要切换到多进程模式,打开配置文件,并且添加计算值:/etc/odoo-server.conf

重启 Odoo服务,使修改生效:

ubuntu python怎么作为守护进程一直运行

测试程序

先写一个测试程序,用于输出日志和打印到控制台。

#-*- coding: utf-8-*-

import logging

import time

from logging.handlers import RotatingFileHandler

def func():

init_log()

while True:

print"output to the console"

logging.debug("output the debug log")

logging.info("output the info log")

time.sleep(3);

def init_log():

logging.getLogger().setLevel(logging.DEBUG)

console= logging.StreamHandler()

console.setLevel(logging.DEBUG)

formatter= logging.Formatter('%(asctime)s%(filename)s[line:%(lineno)d]%(levelname)s%(message)s')

console.setFormatter(formatter)

logging.getLogger().addHandler(console)

# add log ratate

Rthandler= RotatingFileHandler("backend_run.log", maxBytes=10* 1024* 1024, backupCount=100,

encoding="gbk")

Rthandler.setLevel(logging.INFO)

# formatter= logging.Formatter('%(asctime)s%(filename)s[line:%(lineno)d]%(levelname)s%(message)s')

Rthandler.setFormatter(formatter)

logging.getLogger().addHandler(Rthandler)

if __name__=='__main__':

func()

后台启动Python脚本

可以使用下面的命令来启动上面的脚本,让Python在后台运行。

nohup python-u main.py> test.out 2>&1&

来解释一下这几个命令的参数。这一段来自

其中 0、1、2分别代表如下含义:

0– stdin(standard input)

1– stdout(standard output)

2– stderr(standard error)

nohup python-u main.py> test.out 2>&1&

nohup+最后面的&是让命令在后台执行

>out.log是将信息输出到out.log日志中

2>&1是将标准错误信息转变成标准输出,这样就可以将错误信息输出到out.log日志里面来。

运行命令后,会返回一个pid。像下面这样:

[1] 9208

后续可以学习Hadoop它们,把pid存起来,到时候stop的时候就把它杀掉。

跟踪输出文件变化

为了验证脚本可以在后台继续运行,我们退出当前会话。然后重新连接一个Session,然后输入下面的命令来跟踪文件的输出:

tail-f test.out

输出内容如下:

output to the console

2017-03-21 20:15:02,632 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:02,632 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:05,635 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:05,636 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:08,637 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:08,638 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:11,640 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:11,642 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:14,647 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:14,647 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:17,653 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:17,654 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:20,655 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:20,656 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:23,661 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:23,661 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:26,665 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:26,666 main.py[line:12] INFO output the info log

output to the console

2017-03-21 20:15:29,670 main.py[line:11] DEBUG output the debug log

2017-03-21 20:15:29,671 main.py[line:12] INFO output the info log

说明我们的脚本确实在后台持续运行。

结束程序

可以直接通过之前的那个pid杀掉脚本,或者可以通过下面的命令查找pid。

ps-ef| grep python

输出的内容如下:

root 1659 1 0 17:40? 00:00:00/usr/bin/python/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent.py start

root 1921 1659 0 17:40? 00:00:48/usr/bin/python/usr/lib/python2.6/site-packages/ambari_agent/main.py start

user 8866 8187 0 20:03? 00:00:06/usr/bin/python3/usr/bin/update-manager--no-update--no-focus-on-map

root 9208 8132 0 20:12 pts/16 00:00:00 python-u main.py

root 9358 8132 0 20:17 pts/16 00:00:00 grep--color=auto python

可以看到我们的pid是9208,调用kill杀掉就可以了。

kill-9 9208

编写启动及停止脚本

启动脚本

#!/bin/sh

pid=`ps-ef|grep"python-u main.py"| grep-v"grep"|awk'{print$2}'`

if ["$pid"!="" ]

then

echo"main.py already run, stop it first"

kill-9${pid}

fi

echo"starting now..."

nohup python-u main.py> test.out 2>&1&

pid=`ps-ef|grep"python-u main.py"| grep-v"grep"|awk'{print$2}'`

echo${pid}> pid.out

echo"main.py started at pid:"${pid}

停止脚本

#!/bin/sh

pid=`ps-ef|grep"python-u main.py"| grep-v"grep"|awk'{print$2}'`

if ["$pid"!="" ]

then

kill-9${pid}

echo"stop main.py complete"

else

echo"main.py is not run, there's no need to stop it"

fi

稍后我会把实例代码上传到资料共享里面。

python多少版本才能安装dlib(安装不同版本的python)

今天给各位分享python多少版本才能安装dlib的知识,其中也会对安装不同版本的python进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

1、pythonpip安装dlib一直失败?2、如何线上部署用python基于dlib写的人脸识别算法3、ubuntu里面怎么安装dlib4、dlib库,怎么在python中安装5、谁用过python中的第三方库facerecognitionpythonpip安装dlib一直失败?

安装失败需要检查几个问题:

兼容问题,对应的包支持的操作系统,支持的Python版本

安装问题,部分包只能通过源码安装,或者离线的wheel方式安装

核对包的安装文档

如何线上部署用python基于dlib写的人脸识别算法

python使用dlib进行人脸检测与人脸关键点标记

Dlib简介:

首先给大家介绍一下Dlib

Dlib是一个跨平台的C++公共库,除了线程支持,网络支持,提供测试以及大量工具等等优点,Dlib还是一个强大的机器学习的C++库,包含了许多机器学习常用的算法。同时支持大量的数值算法如矩阵、大整数、随机数运算等等。

Dlib同时还包含了大量的图形模型算法。

最重要的是Dlib的文档和例子都非常详细。

Dlib主页:

这篇博客所述的人脸标记的算法也是来自Dlib库,Dlib实现了OneMillisecondFaceAlignmentwithanEnsembleofRegressionTrees中的算法

这篇论文非常出名,在谷歌上打上OneMillisecond就会自动补全,是CVPR2014(国际计算机视觉与模式识别会议)上的一篇国际顶级水平的论文。毫秒级别就可以实现相当准确的人脸标记,包括一些半侧脸,脸很不清楚的情况,论文本身的算法十分复杂,感兴趣的同学可以下载看看。

Dlib实现了这篇最新论文的算法,所以Dlib的人脸标记算法是十分先进的,而且Dlib自带的人脸检测库也很准确,我们项目受到硬件所限,摄像头拍摄到的画面比较模糊,而在这种情况下之前尝试了几个人脸库,识别率都非常的低,而Dlib的效果简直出乎意料。

相对于C++我还是比较喜欢使用python,同时Dlib也是支持python的,只是在配置的时候碰了不少钉子,网上大部分的Dlib资料都是针对于C++的,我好不容易才配置好了python的dlib,这里分享给大家:

Dlibforpython配置:

因为是用python去开发计算机视觉方面的东西,python的这些科学计算库是必不可少的,这里我把常用的科学计算库的安装也涵盖在内了,已经安装过这些库的同学就可以忽略了。

我的环境是Ubuntu14.04:

大家都知道Ubuntu是自带python2.7的,而且很多Ubuntu系统软件都是基于python2.7的,有一次我系统的python版本乱了,我脑残的想把python2.7卸载了重装,然后……好像是提醒我要卸载几千个软件来着,没看好直接回车了,等我反应过来Ctrl+C的时候系统已经没了一半了…

所以我发现想要搞崩系统,这句话比rm-rf还给力…

sudoapt-getremovepython2.71

首先安装两个python第三方库的下载安装工具,ubuntu14.04好像是预装了easy_install

以下过程都是在终端中进行:

1.安装pip

sudoapt-getinstallpython-pip1

2.安装easy-install

sudoapt-getinstallpython-setuptools1

3.测试一下easy_install

有时候系统环境复杂了,安装的时候会安装到别的python版本上,这就麻烦了,所以还是谨慎一点测试一下,这里安装一个我之前在博客中提到的可以模拟浏览器的第三方python库测试一下。

sudoeasy_installMechanize1

4.测试安装是否成功

在终端输入python进入pythonshell

python1

进入pythonshell后import一下刚安装的mechanize

importmechanize1

没有报错,就是安装成功了,如果说没有找到,那可能就是安装到别的python版本的路径了。

同时也测试一下PIL这个基础库

importPIL1

没有报错的话,说明PIL已经被预装过了

5.安装numpy

接下来安装numpy

首先需要安装python-dev才可以编译之后的扩展库

sudoapt-getinstallpython-dev1

之后就可以用easy-install安装numpy了

sudoeasy_installnumpy1

这里有时候用easy-install安装numpy下载的时候会卡住,那就只能用apt-get来安装了:

sudoapt-getinstallnumpy1

不推荐这样安装的原因就是系统环境或者说python版本多了之后,直接apt-get安装numpy很有可能不知道装到哪个版本去了,然后就很麻烦了,我有好几次遇到这个问题,不知道是运气问题还是什么,所以风险还是很大的,所以还是尽量用easy-install来安装。

同样importnumpy进行测试

python

importnumpy1234

没有报错的话就是成功了

下面的安装过程同理,我就从简写了,大家自己每步别忘了测试一下

6.安装scipy

sudoapt-getinstallpython-scipy1

7.安装matplotlib

sudoapt-getinstallpython-matplotlib1

8.安装dlib

我当时安装dlib的过程简直太艰辛,网上各种说不知道怎么配,配不好,我基本把stackoverflow上的方法试了个遍,才最终成功编译出来并且导入,不过听说18.18更新之后有了setup.py,那真是极好的,18.18我没有亲自配过也不能乱说,这里给大家分享我配置18.17的过程吧:

1.首先必须安装libboost,不然是不能使用.so库的

sudoapt-getinstalllibboost-python-devcmake1

2.到Dlib的官网上下载dlib,会下载下来一个压缩包,里面有C++版的dlib库以及例子文档,Pythondlib库的代码例子等等

我使用的版本是dlib-18.17,大家也可以在我这里下载:

之后进入python_examples下使用bat文件进行编译,编译需要先安装libboost-python-dev和cmake

cdtodlib-18.17/python_examples

./compile_dlib_python_module.bat123

之后会得到一个dlib.so,复制到dist-packages目录下即可使用

这里大家也可以直接用我编译好的.so库,但是也必须安装libboost才可以,不然python是不能调用so库的,下载地址:

将.so复制到dist-packages目录下

sudocpdlib.so/usr/local/lib/python2.7/dist-packages/1

最新的dlib18.18好像就没有这个bat文件了,取而代之的是一个setup文件,那么安装起来应该就没有这么麻烦了,大家可以去直接安装18.18,也可以直接下载复制我的.so库,这两种方法应该都不麻烦~

有时候还会需要下面这两个库,建议大家一并安装一下

9.安装skimage

sudoapt-getinstallpython-skimage1

10.安装imtools

sudoeasy_installimtools1

DlibfacelandmarksDemo

环境配置结束之后,我们首先看一下dlib提供的示例程序

1.人脸检测

dlib-18.17/python_examples/face_detector.py源程序:

#!/usr/bin/python#Thecontentsofthisfileareinthepublicdomain.SeeLICENSE_FOR_EXAMPLE_PROGRAMS.txt##?Thisexampleprogramshowshowtofindfrontalhumanfacesinanimage.?In#?particular,itshowshowyoucantakealistofimagesfromthecommand#?lineanddisplayeachonthescreenwithredboxesoverlaidoneachhuman#?face.##?Theexamples/facesfoldercontainssomejpgimagesofpeople.?Youcanrun#?thisprogramonthemandseethedetectionsbyexecutingthe#?followingcommand:#???./face_detector.py../examples/faces/*.jpg##?ThisfacedetectorismadeusingthenowclassicHistogramofOriented#?Gradients(HOG)featurecombinedwithalinearclassifier,animage#?pyramid,andslidingwindowdetectionscheme.?Thistypeofobjectdetector#?isfairlygeneralandcapableofdetectingmanytypesofsemi-rigidobjects#?inadditiontohumanfaces.?Therefore,ifyouareinterestedinmaking#?yourownobjectdetectorsthenreadthetrain_object_detector.pyexample#?program.?###COMPILINGTHEDLIBPYTHONINTERFACE#?Dlibcomeswithacompiledpythoninterfaceforpython2.7onMSWindows.If#?youareusinganotherpythonversionoroperatingsystemthenyouneedto#?compilethedlibpythoninterfacebeforeyoucanusethisfile.?Todothis,#?runcompile_dlib_python_module.bat.?Thisshouldworkonanyoperating#?systemsolongasyouhaveCMakeandboost-pythoninstalled.#?OnUbuntu,thiscanbedoneeasilybyrunningthecommand:#???sudoapt-getinstalllibboost-python-devcmake##?Alsonotethatthisexamplerequiresscikit-imagewhichcanbeinstalled#?viathecommand:#???pipinstall-Uscikit-image#?Ordownloadedfrom.importsys

importdlib

fromskimageimportio

detector=dlib.get_frontal_face_detector()

win=dlib.image_window()

print("a");forfinsys.argv[1:]:

print("a");

print("Processingfile:{}".format(f))

img=io.imread(f)

#The1inthesecondargumentindicatesthatweshouldupsampletheimage

#1time.?Thiswillmakeeverythingbiggerandallowustodetectmore

#faces.

dets=detector(img,1)

print("Numberoffacesdetected:{}".format(len(dets)))??fori,dinenumerate(dets):

print("Detection{}:Left:{}Top:{}Right:{}Bottom:{}".format(

i,d.left(),d.top(),d.right(),d.bottom()))

win.clear_overlay()

win.set_image(img)

win.add_overlay(dets)

dlib.hit_enter_to_continue()#Finally,ifyoureallywanttoyoucanaskthedetectortotellyouthescore#foreachdetection.?Thescoreisbiggerformoreconfidentdetections.#Also,theidxtellsyouwhichofthefacesub-detectorsmatched.?Thiscanbe#usedtobroadlyidentifyfacesindifferentorientations.if(len(sys.argv[1:])0):

img=io.imread(sys.argv[1])

dets,scores,idx=detector.run(img,1)??fori,dinenumerate(dets):

print("Detection{},score:{},face_type:{}".format(

d,scores[i],idx[i]))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081

我把源代码精简了一下,加了一下注释:face_detector0.1.py

#-*-coding:utf-8-*-importsys

importdlib

fromskimageimportio#使用dlib自带的frontal_face_detector作为我们的特征提取器detector=dlib.get_frontal_face_detector()#使用dlib提供的图片窗口win=dlib.image_window()#sys.argv[]是用来获取命令行参数的,sys.argv[0]表示代码本身文件路径,所以参数从1开始向后依次获取图片路径forfinsys.argv[1:]:??#输出目前处理的图片地址

print("Processingfile:{}".format(f))??#使用skimage的io读取图片

img=io.imread(f)??#使用detector进行人脸检测dets为返回的结果

dets=detector(img,1)??#dets的元素个数即为脸的个数

print("Numberoffacesdetected:{}".format(len(dets)))??#使用enumerate函数遍历序列中的元素以及它们的下标

#下标i即为人脸序号

#left:人脸左边距离图片左边界的距离;right:人脸右边距离图片左边界的距离

#top:人脸上边距离图片上边界的距离;bottom:人脸下边距离图片上边界的距离

fori,dinenumerate(dets):

print("dets{}".format(d))

print("Detection{}:Left:{}Top:{}Right:{}Bottom:{}"

.format(i,d.left(),d.top(),d.right(),d.bottom()))??#也可以获取比较全面的信息,如获取人脸与detector的匹配程度

dets,scores,idx=detector.run(img,1)

fori,dinenumerate(dets):

print("Detection{},dets{},score:{},face_type:{}".format(i,d,scores[i],idx[i]))??

#绘制图片(dlib的ui库可以直接绘制dets)

win.set_image(img)

win.add_overlay(dets)??#等待点击

dlib.hit_enter_to_continue()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950

分别测试了一个人脸的和多个人脸的,以下是运行结果:

运行的时候把图片文件路径加到后面就好了

pythonface_detector0.1.py./data/3.jpg12

一张脸的:

两张脸的:

这里可以看出侧脸与detector的匹配度要比正脸小的很多

2.人脸关键点提取

人脸检测我们使用了dlib自带的人脸检测器(detector),关键点提取需要一个特征提取器(predictor),为了构建特征提取器,预训练模型必不可少。

除了自行进行训练外,还可以使用官方提供的一个模型。该模型可从dlibsourceforge库下载:

arks.dat.bz2

也可以从我的连接下载:

这个库支持68个关键点的提取,一般来说也够用了,如果需要更多的特征点就要自己去训练了。

dlib-18.17/python_examples/face_landmark_detection.py源程序:

#!/usr/bin/python#Thecontentsofthisfileareinthepublicdomain.SeeLICENSE_FOR_EXAMPLE_PROGRAMS.txt##?Thisexampleprogramshowshowtofindfrontalhumanfacesinanimageand#?estimatetheirpose.?Theposetakestheformof68landmarks.?Theseare#?pointsonthefacesuchasthecornersofthemouth,alongtheeyebrows,on#?theeyes,andsoforth.##?ThisfacedetectorismadeusingtheclassicHistogramofOriented#?Gradients(HOG)featurecombinedwithalinear

ubuntu里面怎么安装dlib

下面是在ubuntu下如何为Python安装dlib:

1.在官网dlib官网下载最新版本的dlib

由于dlib最初是一个C++库,要安装为python第三方库,

2.要下载boost将C++编译为python,同时还要下载cmake

命令:sudoapt-getinstalllibboost-python-devcmake11

3.然后切换到dlib-18.17/python_examples目录

然后运行

./compile_dlib_python_module.bat11

会生成dlib.so

4.该脚本还要加上可执行权限

这样在dlib-18.17/python_examples目录下就可以导入dlib库,但在其它地方还不能导入

将dlib.so复制到python第三库的文件夹下

sudocpdlib.so/usr/local/lib/python2.7/dist-packages/11

这样dlib库就安装好了

dlib库,怎么在python中安装

因为这个工程中用到的依赖库比较多,所以索性下载了Anaconda,它是一个python的发行版,包括了python和很多常见的软件库,和一个包管理器conda,所以安装了Anaconda后就不用再安装python了。

1、下载Anaconda的链接:

我下载的是对应python2.7version的64位Anaconda4.2.0,我的电脑系统是win64。

2、现在的问题就转换成如何用Anaconda安装第三方库的问题(Anaconda不包含dlib库),在自己电脑上运行cmd.exe,直接在默认的路径上面执行如下程序即可安装成功:

condainstall-cmenpodlib=18.18

3、执行没问题的话,结果应该如上图所示。困扰我好几天的问题终于解决了,走的太多的弯路,不过也是一个学习的过程,希望大家能有所收获吧。

谁用过python中的第三方库facerecognition

简介

该库可以通过python或者命令行即可实现人脸识别的功能。使用dlib深度学习人脸识别技术构建,在户外脸部检测数据库基准(LabeledFacesintheWild)上的准确率为99.38%。

在github上有相关的链接和API文档。

在下方为提供的一些相关源码或是文档。当前库的版本是v0.2.0,点击docs可以查看API文档,我们可以查看一些函数相关的

阅读剩余
THE END