I installed CRF++0.58 in Python 2.7.6
When I try to import I have the following message:
>>> import CRFPP
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "CRFPP.py", line 42, in <module>
_CRFPP = swig_import_helper()
File "CRFPP.py", line 34, in swig_import_helper
import _CRFPP
ImportError: No module named _CRFPP
>>>
The procedure to install is described in the README file in python directory of CRF++0.58, and is:
$ python setup.py build
$ sudo python setup.py install
This placed in the directory /usr/local/lib/python2.7/dist-packages/ :
- CRFPP.py
- CRFPP.pyc
_CRFPP.so
The directory /usr/local/lib/python2.7/dist-packages/ is in the sys.path
In the CRFPP.py in the setup directory contains, in its begin, the following procedure:
#This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_CRFPP',[dirname(__file__)]) except ImportError: import _CRFPP return _CRFPP if fp is not None: try: _mod = imp.load_module('_CRFPP', fp, pathname, description) finally: fp.close() return _mod _CRFPP = swig_import_helper() del swig_import_helper else: import _CRFPP del version_info
imp does not find _CRFPP.so, but found CRFPP.py:
>>> import imp
>>> imp.find_module("_CRFPP")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named _CRFPP
>>> imp.find_module("CRFPP")
(<open file '/usr/local/lib/python2.7/dist-packages/CRFPP.py', mode 'U' at 0x7f7748e4a540>, '/usr/local/lib/python2.7/dist-packages/CRFPP.py', ('.py', 'U', 1))