【问题标题】:Import scikit in C# application在 C# 应用程序中导入 scikit
【发布时间】:2013-11-30 22:54:12
【问题描述】:

我正在尝试在 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?如果是,您能否提供解决方法?

【问题讨论】:

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-19
    • 1970-01-01
    • 2020-08-13
    • 2012-05-10
    • 2016-10-29
    • 1970-01-01
    • 2013-02-17
    • 1970-01-01
    相关资源
    最近更新 更多