c# 调用python
2016-07-29 09:37
260 查看
1.安装python2.7(我的安装目录为C:\Python27)
2.在python2.7的安装目录中,找到Lib文件夹,复制整个文件夹到项目中
View Code
2.在python2.7的安装目录中,找到Lib文件夹,复制整个文件夹到项目中
using Hm.Common.InitPythonRuntime; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace { public class PythonUtil { private InitRuntime pythonRuntime=null; //python文件位置 private readonly string PythonFilePath="....a.py" private readonly string DllPath=AppDomain.BaseDirectory+"Hammer.Common.dll"; public bool AnalysisEndStr(string targetStr) { if(pythonRuntime==null) pythonRuntime=new InitRuntime(); pythonRuntime.loadPythonFile(DllPath,PythonFilePath); dynamic obj=pythonRuntime.GetDPython(); return obj.callPthon("IsEndStr",targetStr); } } }
View Code
相关文章推荐
- C# 调用批python 脚本
- 在C#中调用python方法
- Windows平台下如何在C#中调用Python
- C#调用Python语言
- 编程:C#调用Python模块
- C#下的webservcie 实现代码和 在vc和python下的调用实现(原创)
- python与C#的互相调用
- 在C#中调用Python方法
- 使用C#调用Python脚本,带参数列表 z
- C#调用Python脚本的简单示例
- 在C#中调用python方法
- 在C#中调用python方法
- 【转】C#中调用python脚本
- vb.net / C# 调用 python
- 关于使用c#调用python脚本文件,脚本文件需要传递参数
- 在C#中调用python方法
- C#中调用python脚本语言
- 基于MySQL数据库的C#与Python语言交互调用
- C#调用Python脚本的简单示例
- 在C#中调用python方法