我用的是Mac电脑。步骤1:
sudo conda install -c conda-forge shogun
第2步:
$ python
Python 2.7.12 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import shogun
>>> from shogun import RealFeatures, PolyKernel, CSVFile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name RealFeatures我还使用RPM在Fedora上进行了尝试。在验证C++接口(gcc shogun.cpp -I/usr/include/shogun/base -lshogun -L/usr/lib64/libshogun.*)正常工作后,我按照here和set PYTHONPATH=/usr/lib64/python2.7/site-packages/modshogun.py的说明进行操作
然后:
$ python
Python 2.7.13 (default, May 10 2017, 20:04:36)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shogun
>>> from shogun import RealFeatures, PolyKernel, CSVFile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name RealFeatures发布于 2017-08-23 08:34:40
这里的问题可能是,幕府的文档目前是针对正在开发的6.1版本,但conda包是针对最新的实际版本6.0。在6.0中,您需要执行from modshogun import RealFeatures;shogun包是旧的接口,而现代的“模块化”包是modshogun。在即将发布的6.1版本中,它将被重命名为shogun。
https://stackoverflow.com/questions/45578184
复制相似问题