我正在尝试在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.
“C:\ Python27 \ Lib \ site-packages \ sklearn__check_build \”中存在“_check_build.pyd”文件。
我的代码基于这篇文章:http://devleader.ca/2013/09/23/visual-studio-c-python-sweet/ 我使用的文件只有以下代码:
from sklearn.svm import SVC
print('Hello Python in C#')
是否可以在C#中添加和使用scikit?如果是,请您提供解决方法吗?
答案 0 :(得分:1)
看起来scikit-learn需要C扩展,这意味着它不会在IronPython下运行。