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

泰安三合一网站建设公司郑州seo教程

泰安三合一网站建设公司,郑州seo教程,美国购买网站空间,深圳龙华区福城街道因为开发需要,我们经常会用C#来写一些库供python调用,但是在使用过程中难免会碰到一些问题,需要我们抽丝剥茧来解决~~~ 首先,我们在python中要想调用C#(基于.net)的dll,需要安装一个库,它就是 pythonnet …

因为开发需要,我们经常会用C#来写一些库供python调用,但是在使用过程中难免会碰到一些问题,需要我们抽丝剥茧来解决~~~

首先,我们在python中要想调用C#(基于.net)的dll,需要安装一个库,它就是

pythonnet

这个安装过程就省略了.... 

然后,在python项目的开头,需要作如下引用:

import clr

那我们就以调用hpy-Library.dll为例,我们先看看是否能载入成功~~

sys.path.append(os.getcwd() + r"\windll")    # hpy-Library.dll 文件所在位置
dll_load = clr.AddReference('hpy-Library')print(dll_load)
print(clr._available_namespaces)
print("hpy_Library in namespaces:", "hpy_Library" in clr._available_namespaces)

如果不出意外的话,将会输出以下内容:

hpy-Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
{'System.IO.Ports', 'Python.Runtime', 'System.Collections.Generic', 'System.CodeDom.Compiler', 'System.Diagnostics.Contracts.Internal', 'System.Xml.Serialization', 'System.Net.WebSockets', 'System.Runtime.InteropServices', 'System.Management', 'System.Runtime.InteropServices.ComTypes', 'System.Net.NetworkInformation', 'System.Configuration.Assemblies', 'System.Security.Policy', 'System.Net.Configuration', 'System.Security.Authentication.ExtendedProtection', 'System.Runtime.ExceptionServices', 'System.Xml.Serialization.Advanced', 'System.Text', 'System.Security.Cryptography', 'System.Xml.Serialization.Configuration', 'System.IO.Compression', 'System.Security.Authentication.ExtendedProtection.Configuration', 'System.Runtime.Versioning', 'System.Runtime.Serialization.Formatters.Binary', 'System.Runtime.Remoting.Channels', 'System.Security', 'System.Runtime.Remoting.Services', 'System.Timers', 'System.Security.AccessControl', 'System.Xml', 'System.ComponentModel.Design.Serialization', 'System.IO', 'System.Net.Mail', 'System.Globalization', 'ClrLoader', 'System.Configuration.Internal', 'System.Collections.Specialized', 'Python', 'Microsoft', 'System.Web', 'System.IO.IsolatedStorage', 'System.IO.MemoryMappedFiles', 'System.Security.Principal', 'Microsoft.Win32', 'System.Windows.Input', 'System.Diagnostics.Eventing', 'System.Net', 'System.Runtime.Remoting', 'System.Linq', 'System.Runtime.Remoting.Metadata.W3cXsd2001', 'System.Security.Permissions', 'System.Runtime.Remoting.Activation', 'System.Diagnostics.Eventing.Reader', 'System.Threading.Tasks', 'System.Net.Cache', 'System.Runtime.Serialization', 'System.Runtime.Remoting.Lifetime', 'hpy_Library', 'System.Runtime.InteropServices.WindowsRuntime', 'System.Runtime.ConstrainedExecution', 'System.Net.Security', 'System', 'System.Linq.Expressions', 'System.Runtime.Remoting.Proxies', 'Microsoft.CSharp', 'System.Security.Cryptography.X509Certificates', 'System.Collections.Concurrent', 'System.CodeDom', 'System.Diagnostics', 'Microsoft.Win32.SafeHandles', 'System.Diagnostics.SymbolStore', 'System.Net.Sockets', 'System.Collections', 'System.Diagnostics.Contracts', 'System.Security.Claims', 'System.ComponentModel.Design', 'System.Security.Authentication', 'System.Xml.XmlConfiguration', 'System.Configuration.Provider', 'System.Windows', 'System.Xml.Schema', 'System.Reflection', 'System.Runtime.DesignerServices', 'System.Deployment', 'System.Threading', 'System.Dynamic', 'System.Runtime.Remoting.Metadata', 'System.IO.Pipes', 'System.Collections.ObjectModel', 'System.Diagnostics.Tracing', 'System.Xml.Xsl', 'System.Windows.Markup', 'System.Runtime.CompilerServices', 'System.Runtime.Remoting.Contexts', 'Python.Runtime.Codecs', 'System.Xml.XPath', 'System.Media', 'Microsoft.VisualBasic', 'System.Management.Instrumentation', 'System.Xml.Resolvers', 'System.Runtime.Remoting.Messaging', 'System.Runtime.Hosting', 'System.ComponentModel', 'System.Text.RegularExpressions', 'System.Runtime.Serialization.Formatters', 'System.Runtime.InteropServices.Expando', 'System.Deployment.Internal', 'System.Runtime', 'System.Net.Mime', 'System.Diagnostics.PerformanceData', 'System.Reflection.Emit', 'System.Resources', 'System.Configuration', 'System.Diagnostics.CodeAnalysis'}
hpy_Library in namespaces: True

第一行表示hpy-Library的版本等相关信息

第二行为clr当前激活的名字空间,这里会包含很多.net库的名字空间

第三行即检查hpy_Library是否在available的namespaces中,结果为真即表示dll载入成功,可用。那么下面你就可以开始使用你的C#外部dll库了~~ ex:

sys.path.append(os.getcwd() + r"\windll")    # hpy-Library.dll 文件所在位置
dll_load = clr.AddReference('hpy-Library')#print(dll_load)
#print(clr._available_namespaces)
#print("hpy_Library in namespaces:", "hpy_Library" in clr._available_namespaces)from hpy_Library import *
aud_sts = AudioStatus()# go on your code 
...

http://www.dinnco.com/news/55655.html

相关文章:

  • 政府网站建设长沙汕头网站制作设计
  • 微信网站开发简单优化关键词快速排名
  • 网站开发自学网站端口扫描站长工具
  • 网站备案账号是什么样的华为seo诊断及优化分析
  • 门店智能经营平台入门seo技术教程
  • 宿迁网站建设公司域名注册查询软件
  • 湛江建设培训学校网站济南网站建设公司选济南网络
  • WordPress的博客添加按钮seo咨询解决方案
  • ip地址免费系统优化大师
  • wordpress 官方插件个人如何优化网站有哪些方法
  • wordpress 充值插件宁波seo营销平台
  • 杭州市建设工程招标合肥seo服务商
  • 如何建立分销网站企业文化理念
  • 肇庆企业建站程序小程序推广50个方法
  • 网站建设我们的优势网站推广排名哪家公司好
  • 做漂亮的网站网站推广费用一般多少钱
  • 网站服务建设全球搜钻是什么公司
  • 武汉专业做网站公司广州网站推广软件
  • 东昌府聊城做网站费用seo优化顾问服务阿亮
  • 程序员做彩票网站违法吗推广神器
  • 4500急招一位接送小孩阿姨附近嘉兴seo外包服务商
  • wordpress用的什么主题查询青岛建站seo公司
  • 怎样用手机做网站网站推广优化怎样
  • 校园安全网站建设百度竞价推广开户多少钱
  • 西安做网站选哪家sem推广是什么意思
  • 如何做淘客推广网站百度资源分享网
  • 怎么用ps做简单网站首页上海十大公关公司排名
  • 湖北网站建设营销qq专业seo培训
  • 罗岗网站建设公司十大网络营销经典案例
  • 网站开发建设账务处理程序全达seo