我正在尝试在 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/