在C#应用程序中导入scikit [英] Import scikit in C# application

查看:211
本文介绍了在C#应用程序中导入scikit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在C#(控制台)应用程序中导入scikit-learn.我正在使用适用于Visual Studio和IronPython 2.7.3的Python工具.

I am trying to import scikit-learn in a C# (console) application. I am using Python Tools for Visual Studio and IronPython 2.7.3.

我设法运行了一个外部python脚本,并且还通过声明python路径设法导入了numpy:"C:\ Python27 \ Lib \ site-packages \"

I managed to run an external python script and I also managed to import numpy by declaring the python path: "C:\Python27\Lib\site-packages\"

但是,在scikit-learn上,我收到一条错误消息:

However, when it comes to scikit-learn I get an error message:

Oops! We couldn't execute the script because of an exception: No module named _c
heck_build
___________________________________________________________________________
Contents of C:\Python27\Lib\site-packages\sklearn\__check_build:
setup.py                  setup.pyc                 setup.pyo
_check_build.pyd          __init__.py               __init__.pyc
__init__.pyo
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

"_ check_build.pyd"文件存在于"C:\ Python27 \ Lib \ site-packages \ sklearn__check_build \"中.

The file "_check_build.pyd" exists in "C:\Python27\Lib\site-packages\sklearn__check_build\".

我的代码基于这篇文章: http://devleader.ca/2013/09/23/visual-studio-c-python-sweet/ 我正在使用的文件只有以下代码:

My code is based on this article: http://devleader.ca/2013/09/23/visual-studio-c-python-sweet/ The file I am using has only the following code:

from sklearn.svm import SVC

print('Hello Python in C#')

是否可以在C#中添加和使用scikit?如果是,请提供解决方法吗?

Is it possible to add and use scikit in C#? If yes, could you please provide a workaround?

推荐答案

像scikit-learn一样,需要C扩展名,这意味着它不会在IronPython下运行.

Looks like scikit-learn requires a C extension, which means it won't run under IronPython.

这篇关于在C#应用程序中导入scikit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆