c# - 在 C# 应用程序中导入 scikit

标签 c# python visual-studio ironpython scikit-learn

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

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

但是,当涉及到 scikit-learn 时,我收到一条错误消息:

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\”中。

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

from sklearn.svm import SVC

print('Hello Python in C#')

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

最佳答案

看起来 scikit-learn 需要 C 扩展,这意味着它不会在 IronPython 下运行。

关于c# - 在 C# 应用程序中导入 scikit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20036793/

相关文章:

Python 字符串连接性能

python - 防止打开第二个实例

asp.net - Application Insights 将 ConnectedService.json 文件添加到我的项目中,这有什么作用?

visual-studio - 从 UNIX 程序员的角度来看的 Visual Studio IDE

c# - 如何将 EventArgs 传递给 DelegateCommand?

c# - WPF 工具包 PropertyGrid ExpandableObject 属性未正确显示嵌套类

c# - 如何根据多个条件使用 Linq 查找特定项目?

c# - 按字段排序列表 (C#)

python - 为列表中的元素过滤 Pandas DataFrame

sql - 如何指定矩阵中列的顺序?