资源简介
使用方法查看:https://blog.csdn.net/songqiu65/article/details/88116549
通过dlib源码编译python失败,通过修改setup.py后,配合cmake和mingw进行编译dlib并生成python库。如果你想要其他的替换mingw,请文件搜索change this。
代码片段和文件信息
“““setup for the dlib project
Copyright (C) 2015 Ehsan Azar (dashesy@linux.com)
License: Boost Software License See LICENSE.txt for the full license.
This file basically just uses CMake to compile the dlib python bindings project
located in the tools/python folder and then puts the outputs into standard
python packages.
To build the dlib:
python setup.py build
To build and install:
python setup.py install
To package the wheel (after pip installing twine and wheel):
python setup.py bdist_wheel
To upload the binary wheel to PyPi
twine upload dist/*.whl
To upload the source distribution to PyPi
python setup.py sdist
twine upload dist/dlib-*.tar.gz
To exclude certain options in the cmake config use --no:
for example:
--no USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=no
Additional options:
--compiler-flags: pass flags onto the compiler e.g. --compiler-flags “-Os -Wall“ passes -Os -Wall onto GCC.
-G: Set the CMake generator. E.g. -G “Visual Studio 14 2015“
--clean: delete any previous build folders and rebuild. You should do this if you change any build options
by setting --compiler-flags or --no since the last time you ran a build. This will
ensure the changes take effect.
--set: set arbitrary cmake options e.g. --set CUDA_HOST_COMPILER=/usr/bin/gcc-6.4.0
passes -DCUDA_HOST_COMPILER=/usr/bin/gcc-6.4.0 to CMake.
“““
import os
import re
import sys
import shutil
import platform
import subprocess
import multiprocessing
from distutils import log
from math import ceilfloor
from setuptools import setup Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
def get_extra_cmake_options():
“““read --clean --no --set --compiler-flags and -G options from the command line and add them as cmake switches.
“““
_cmake_extra_options = []
_clean_build_folder = False
opt_key = None
argv = [arg for arg in sys.argv] # take a copy
# parse command line options and consume those we care about
for arg in argv:
if opt_key == ‘compiler-flags‘:
_cmake_extra_options.append(‘-DCMAKE_CXX_FLAGS={arg}‘.format(arg=arg.strip()))
elif opt_key == ‘G‘:
_cmake_extra_options += []
elif opt_key == ‘no‘:
_cmake_extra_options.append(‘-D{arg}=no‘.format(arg=arg.strip()))
elif opt_key == ‘set‘:
_cmake_extra_options.append(‘-D{arg}‘.format(arg=arg.strip()))
if opt_key:
sys.argv.remove(arg)
opt_key = None
continue
if arg == ‘--clean‘:
_clean_build_folder = True
sys.argv.remove(arg)
continue
if arg == ‘--yes‘:
print(“The --yes options to dlib‘s setup.py don‘t do anything since all these options “)
print(“are on by default. So --yes has been removed. Do not give it to setup.py.“)
sys.exit(1)
- 上一篇:树莓派动作捕捉抓拍存储图像脚本
- 下一篇:决策树分类算法
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论