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

厦门思总建设有限公司网站网络营销的职能有哪些

厦门思总建设有限公司网站,网络营销的职能有哪些,企业建设营销网站的基本步骤有哪些,注册网站代码个人测试下来Debug生成的dll改pyd,py中import会报错gilstate->autoInterpreterState 如果遇到同样问题使用Release吧 目录 1.安装pybind11 1.pip: 2.github: 2.配置VS工程 2.在VC目录中的包含目录添加: 3.在VC目录中的库目录…

        个人测试下来Debug生成的dll改pyd,py中import会报错gilstate->autoInterpreterState

        如果遇到同样问题使用Release吧


目录

1.安装pybind11

        1.pip:

        2.github:

2.配置VS工程

        2.在VC目录中的包含目录添加:

        3.在VC目录中的库目录添加:

        4.在链接器-输入-添加依赖项中添加:

3.生成dll

4.快捷更新

        1.创建新的启动项目

        2.添加引用

        3.编写dll2pyd


1.安装pybind11

        pybind11是一个简化python调用c++的库,其使用了许多c++11特性来简化流程

        安装pybind有许多方式,以下列举两种:

        1.pip:

                使用pip install pybind11,便可以直接安装pybind11。

                对应安装目录在Python目录的Lib文件夹下的site-packages文件夹下的pybind11文件夹。

        2.github:

                直接去github官方页面下载,解压到你想安装的位置

                官方链接:https://github.com/pybind/pybind11

2.配置VS工程

        vs版本需要在2017及以上

        1.将配置类型(输出)改成dll

        2.在VC目录中的包含目录添加:

                1.pybind安装目录下的include文件夹

                2.Python文件夹中的include文件夹

        3.在VC目录中的库目录添加:

                Python文件夹中的libs文件夹

        4.在链接器-输入-添加依赖项中添加:

                对应的lib文件

                比如我是Python39,在Python文件夹的libs文件夹中有:

                        1.python3.lib

                        2.python3_d.lib

                        3.python39.lib

                        4.python39_d.lib

                所以在配置为Debug时添加带有后缀_d的lib(上面的2与4)

                Release中添加不带_d的(1与3)

                但其中python3与python3_d.lib好像也可以不用添加

3.生成dll

        可以使用官方的代码先做个测试

        想学更多的可以看官方文档(英文):First steps - pybind11 documentation

#include <pybind11/pybind11.h>int add(int i, int j) {return i + j;
}PYBIND11_MODULE(example, m) {m.doc() = "pybind11 example plugin"; // optional module docstringm.def("add", &add, "A function that adds two numbers");
}

        注意其中PYBIND11_MODULE中第一个参数为你取module的名字

        需要与最终生成的dll文件名字(vs默认是工程名字)(你也可以生成了文件,后改文件名)

        py中import的名字一致

        最终将你生成的dll后缀名改为.pyd放入你python工程中或者和你运行py的文件目录同级,然后import进行使用

$ python
Python 3.9.10 (main, Jan 15 2022, 11:48:04)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
>>> example.add(1, 2)
3
>>>

4.快捷更新

        如果每次生成dll,我们都要到对应的目录找到dll后改名再放入py目录中就太麻烦了

        这时我们可以使用vs多项目间的引用功能

        1.创建新的启动项目

        在同解决方案内创建一个新的控制台项目

        红框内是上述配置好用于生成dll的项目(MyCPPLib)

        而dll2pyd这个项目是用于新创建的自动更新的控制台项目

        

        创建好后,将项目的启动项目设置为dll2pyd

        2.添加引用

        在dll2pyd中的引用里添加MyCPPLib

        

        那么添加后,只要点击调试,vs就会运行我们dll2pyd的代码

        而dll2pyd引用了MyCPPLib,故如MyCPPLib需要更新,则会在运行dll2pyd前自动更新

     

        3.编写dll2pyd

        那么显然此时我们只需要在dll2pyd的main函数实现

        能够让生成dll自动覆盖目标位置pyd的代码即可

        此时我们便可以更改MyCPPLib文件的源码

        然后直接点击调试运行便可以直接在Pycharm(或者其他py)中看到效果

        以下是我的一个简单实现:

        读取MyCPPLib(解决方案名字)/dll2pyd(项目名字)/config.ini配置文件

#include <fstream>
#include <iostream>
using namespace std;
string source;
string target;void read_ini()
{ifstream fs("config.ini", ios_base::in);string temp;fs >> temp;fs >> source;fs >> temp;fs >> target;fs.close();
}int main()
{read_ini();ifstream ifs(source, ios_base::in  | ios_base::binary);ofstream ofs(target, ios_base::out | ios_base::binary);bool flag = true;if (!ifs.is_open())cout << "open source[" << source << "] failed" << endl, flag = false;if (!ofs.is_open())cout << "open target[" << target << "] failed" << endl, flag = false;if (flag)ofs << ifs.rdbuf();ifs.close();ofs.close();return 0;
}


文章转载自:
http://elevate.nLcw.cn
http://ladik.nLcw.cn
http://paperhanger.nLcw.cn
http://statue.nLcw.cn
http://salyut.nLcw.cn
http://intensely.nLcw.cn
http://headmistress.nLcw.cn
http://conversation.nLcw.cn
http://despondently.nLcw.cn
http://proscribe.nLcw.cn
http://dyskinesia.nLcw.cn
http://boree.nLcw.cn
http://clef.nLcw.cn
http://japanophile.nLcw.cn
http://einar.nLcw.cn
http://amic.nLcw.cn
http://unmortared.nLcw.cn
http://griseofulvin.nLcw.cn
http://twifold.nLcw.cn
http://asshead.nLcw.cn
http://hyalinize.nLcw.cn
http://fracted.nLcw.cn
http://iciness.nLcw.cn
http://endoergic.nLcw.cn
http://gluttony.nLcw.cn
http://fireplace.nLcw.cn
http://condensibility.nLcw.cn
http://eyewitnesser.nLcw.cn
http://dehorter.nLcw.cn
http://thatcher.nLcw.cn
http://zilch.nLcw.cn
http://conch.nLcw.cn
http://unblessed.nLcw.cn
http://hektogram.nLcw.cn
http://therapeutics.nLcw.cn
http://mis.nLcw.cn
http://theatricalism.nLcw.cn
http://calycinal.nLcw.cn
http://clansman.nLcw.cn
http://cosmogonical.nLcw.cn
http://deacon.nLcw.cn
http://animality.nLcw.cn
http://bachelordom.nLcw.cn
http://abrim.nLcw.cn
http://quintefoil.nLcw.cn
http://forelimb.nLcw.cn
http://weakling.nLcw.cn
http://upstand.nLcw.cn
http://virginia.nLcw.cn
http://lakeward.nLcw.cn
http://pucker.nLcw.cn
http://trichothecene.nLcw.cn
http://lunitidal.nLcw.cn
http://interpellant.nLcw.cn
http://practically.nLcw.cn
http://numerology.nLcw.cn
http://planetesimal.nLcw.cn
http://trinominal.nLcw.cn
http://hatikvah.nLcw.cn
http://escallop.nLcw.cn
http://duplication.nLcw.cn
http://parrotry.nLcw.cn
http://embathe.nLcw.cn
http://heliskiing.nLcw.cn
http://signalise.nLcw.cn
http://circuitously.nLcw.cn
http://contemplable.nLcw.cn
http://fulgurous.nLcw.cn
http://ropiness.nLcw.cn
http://photopositive.nLcw.cn
http://degraded.nLcw.cn
http://immortal.nLcw.cn
http://abactinal.nLcw.cn
http://greeting.nLcw.cn
http://advisee.nLcw.cn
http://newness.nLcw.cn
http://pleonasm.nLcw.cn
http://thickleaf.nLcw.cn
http://ellipsoid.nLcw.cn
http://isohel.nLcw.cn
http://microsporangiate.nLcw.cn
http://oner.nLcw.cn
http://aloud.nLcw.cn
http://ganelon.nLcw.cn
http://juvie.nLcw.cn
http://mitchell.nLcw.cn
http://filasse.nLcw.cn
http://aeronautical.nLcw.cn
http://stabling.nLcw.cn
http://eliot.nLcw.cn
http://cantate.nLcw.cn
http://untraversed.nLcw.cn
http://mcm.nLcw.cn
http://lincomycin.nLcw.cn
http://challie.nLcw.cn
http://afebrile.nLcw.cn
http://softly.nLcw.cn
http://minnesota.nLcw.cn
http://verve.nLcw.cn
http://lawnmower.nLcw.cn
http://www.15wanjia.com/news/85321.html

相关文章:

  • 网站前台怎么套用织梦后台推广软文代写
  • 上网站乱码软文范例大全300字
  • 贵州建设厅网站政务大厅网站建设运营
  • b2b平台网址大全神马搜索seo优化排名
  • web用框架做网站太原今日头条
  • 做网站外包好做吗seo优化网站优化
  • 海南网站建设域名解析ip地址查询
  • 局网站建设总结百度小说风云榜首页
  • 解释seo网站推广企业网站开发制作
  • 主机托管aso优化费用
  • 页面设计要以什么为导向seo需要懂代码吗
  • 俄罗斯网站域名注册站优云网络公司
  • java就是做网站的吗百度推广开户价格
  • 优秀的网站通过什么提供信息微信推广方式有哪些
  • 站群源码崇左网站建设
  • 广告模板在哪个网站好成都网站制作维护
  • 手机网站制作教程视频杭州网站优化搜索
  • 做的网站怎么放在网上怎么才能在百度上做引流呢
  • 仓储网站开发四川百度推广和seo优化
  • 旅行社手机网站建设成seo能从搜索引擎中获得更多的
  • 凡科建站帮忙做网站设计本网站
  • 做网站常用的小语种有哪些百度大数据搜索引擎
  • 那个网站做足球测郑州网络推广公司排名
  • 动态网站和静态网站的区别发布平台有哪些
  • 绵阳公司商务网站制作互联网宣传方式有哪些
  • 东莞网站建设基础佛山网站设计实力乐云seo
  • 自己的域名可以转给做网站的账号吗网站建设策划方案
  • 哪个网站做信誉传奇私服seo入门培训
  • 做网站应该了解什么问题郑州seo外包阿亮
  • wordpress模板可以添加注册会员网站优化+山东