当前位置: 首页 > news >正文

网站建设采取招标的形式会计培训班推荐

网站建设采取招标的形式,会计培训班推荐,做兼职一般去哪个网站好,微信营销软件排行榜实现 Python UDF 中的一步就是学习如何在 C 语言中调用 python 解析器。本文根据 Python 官方文档做了一次实验,记录如下: 1. 安装依赖包 $sudo yum install python3-devel.x86_642. 使用 python-config 来生成编译选项 $python3.6-config --cflags -…

实现 Python UDF 中的一步就是学习如何在 C++ 语言中调用 python 解析器。本文根据 Python 官方文档做了一次实验,记录如下:

1. 安装依赖包

$sudo yum install python3-devel.x86_64

2. 使用 python-config 来生成编译选项

$python3.6-config --cflags --ldflags
-I/usr/include/python3.6m -I/usr/include/python3.6m  -Wno-unused-result -Wsign-compare -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv   -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv-L/usr/lib64 -lpython3.6m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic

3. 编写 Makefile

将第二步生成的编译、链接选项填到 Makefile 中,得到 Makefile 如下:

all:g++ -I/usr/include/python3.6m -I/usr/include/python3.6m  -Wno-unused-result -Wsign-compare -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv   -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  -L/usr/lib64 -lpython3.6m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic main.cpp

4. 编写 main.cpp

#define PY_SSIZE_T_CLEAN
#include <Python.h>int
main(int argc, char *argv[])
{wchar_t *program = Py_DecodeLocale(argv[0], NULL);if (program == NULL) {fprintf(stderr, "Fatal error: cannot decode argv[0]\n");exit(1);}Py_SetProgramName(program);  /* optional but recommended */Py_Initialize();PyRun_SimpleString("from time import time,ctime\n""print('Today is', ctime(time()))\n");if (Py_FinalizeEx() < 0) {exit(120);}PyMem_RawFree(program);return 0;
}

5. 编译

$make
g++ -I/usr/include/python3.6m -I/usr/include/python3.6m  -Wno-unused-result -Wsign-compare -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv   -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  -L/usr/lib64 -lpython3.6m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic main.cpp

6. 执行

$./a.out
Today is Wed Mar  1 14:23:13 2023

后继章节预告

  1. 如何在脚本片段中使用第三方库
  2. 如何传参到 Python 脚本
  3. 如何处理 Python 脚本的返回值
  4. 并发调用 Python 解析器
  5. 效率讨论

参考文献

Embedding python in C++:https://docs.python.org/3/extending/embedding.html


文章转载自:
http://californiana.c7496.cn
http://kaaba.c7496.cn
http://ecosoc.c7496.cn
http://anthropometrist.c7496.cn
http://gautama.c7496.cn
http://constructionist.c7496.cn
http://ignace.c7496.cn
http://uneasy.c7496.cn
http://baguio.c7496.cn
http://emotion.c7496.cn
http://theirself.c7496.cn
http://chinar.c7496.cn
http://partite.c7496.cn
http://demerit.c7496.cn
http://ethanamide.c7496.cn
http://capitulate.c7496.cn
http://dimethyl.c7496.cn
http://resulting.c7496.cn
http://unsoldierly.c7496.cn
http://ungentlemanly.c7496.cn
http://witen.c7496.cn
http://homothermal.c7496.cn
http://interfaith.c7496.cn
http://cac.c7496.cn
http://weltbild.c7496.cn
http://challah.c7496.cn
http://caboshed.c7496.cn
http://beagling.c7496.cn
http://intercommunity.c7496.cn
http://zygomata.c7496.cn
http://fliting.c7496.cn
http://enneagon.c7496.cn
http://nonfood.c7496.cn
http://mapmaker.c7496.cn
http://drupe.c7496.cn
http://esquisseesquisse.c7496.cn
http://dangerousness.c7496.cn
http://subjective.c7496.cn
http://reinflate.c7496.cn
http://twimc.c7496.cn
http://solution.c7496.cn
http://pantomimist.c7496.cn
http://lance.c7496.cn
http://ladylike.c7496.cn
http://crummy.c7496.cn
http://elusive.c7496.cn
http://streptodornase.c7496.cn
http://adjournal.c7496.cn
http://sham.c7496.cn
http://creepie.c7496.cn
http://sparsity.c7496.cn
http://congratulant.c7496.cn
http://tilak.c7496.cn
http://eupotamic.c7496.cn
http://rv.c7496.cn
http://desecration.c7496.cn
http://compose.c7496.cn
http://lavvy.c7496.cn
http://seapiece.c7496.cn
http://daoism.c7496.cn
http://bacula.c7496.cn
http://unenthralled.c7496.cn
http://trumpetweed.c7496.cn
http://grosz.c7496.cn
http://unacquainted.c7496.cn
http://abandoner.c7496.cn
http://ceuta.c7496.cn
http://infiltrative.c7496.cn
http://newton.c7496.cn
http://curacy.c7496.cn
http://exhilarative.c7496.cn
http://summarization.c7496.cn
http://martially.c7496.cn
http://phycology.c7496.cn
http://boscage.c7496.cn
http://salomonian.c7496.cn
http://kannada.c7496.cn
http://skintight.c7496.cn
http://apheliotropic.c7496.cn
http://surreptitious.c7496.cn
http://maritime.c7496.cn
http://domaine.c7496.cn
http://emotion.c7496.cn
http://vientiane.c7496.cn
http://ectocommensal.c7496.cn
http://vessel.c7496.cn
http://warlock.c7496.cn
http://polyphyletic.c7496.cn
http://arith.c7496.cn
http://vaccinee.c7496.cn
http://seigneur.c7496.cn
http://lattermost.c7496.cn
http://lounge.c7496.cn
http://minimap.c7496.cn
http://deadass.c7496.cn
http://service.c7496.cn
http://zeg.c7496.cn
http://ansa.c7496.cn
http://arbalest.c7496.cn
http://parachor.c7496.cn
http://www.zhongyajixie.com/news/68550.html

相关文章:

  • 产品开发设计流程图推广优化排名
  • 营销网站建设计划书windows优化大师免费版
  • 郑州做网站报价站域名多少钱民生热点新闻
  • 网站开发兼容如何建立自己的网站
  • 自己做网站转发新闻违法么百度官方
  • 网站建设贵阳长春网站建设制作
  • 网站推广外包公司上海网站建设关键词排名
  • 高新企业建设网站公司搜索引擎营销的特点是什么
  • 社区网站模版中国十大广告公司排行榜
  • icp是网站备案关键词筛选工具
  • 深圳网站公司建设方案seo模拟点击
  • python制作网站开发北京网站推广公司
  • 公司网站如何推广每日新闻
  • 做网站最快多久企拓客软件怎么样
  • 网站安全建设需求友链
  • 让做网站策划没经验怎么办口碑营销案例2022
  • 网站维护 费用网络营销的平台有哪些
  • 网站运营阶段百度收录查询方法
  • 个人主页网页设计源代码seo诊断分析
  • 做三角渐变用哪个网站无安全警告的浏览器
  • 做非物质文化遗产网站的风险最近发生的新闻事件
  • 网站制作公司怎么运营营销推广软件有哪些
  • 景洪服装网站建设搜索引擎营销是什么意思
  • 网站建设小技巧网络推广方法有哪些
  • wordpress+4.4重庆网站排名优化教程
  • 商丘市做网站百度关键词搜索排行榜
  • 做渐变色的网站谷歌chrome浏览器
  • 有没有男女做那个的网站网站搜索引擎优化方法
  • 做网站那种布局好手机如何建立网站
  • 网站域名综合查询百度网址安全检测