Celery引发了意外的查找错误



我在django项目中使用了芹菜。

java_path = "/your/Java/jdk/home/java.exe
os.environ['JAVAHOME'] = java_path
st = POSTagger('/your/postagger/models/path/english-bidirectional-distsim.tagger','/your/postagger/jar/file/path/stanford-postagger.jar')

tag = st.tag([key])

这里的关键是一个特征词列表。

我在使用芹菜执行时出现了以下错误:

raised unexpected: 
           LookupError('nn===========================================================================nNLTK 
        `was unable to find the java file!nUse software specific configuration paramaters or set the JAVAHOME environment`

variable.n===========================================================================',)
        Traceback (most recent call last):
          File "/Users/Envs/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
            R = retval = fun(*args, **kwargs)
          File "/Users/Envs/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
            return self.run(*args, **kwargs)
          File "/Users/Envs/src/evolvelearning/tasks.py", line 772, in RunProgram
            tag = st.tag([key])
          File "/Users/Envs/lib/python2.7/site-packages/nltk/tag/stanford.py", line 59, in tag
            return self.tag_sents([tokens])[0]
        File "/Users/Envs/lib/python2.7/site-packages/nltk/tag/stanford.py", line 64, in tag_sents
        config_java(options=self.java_options, verbose=False)
      File "/Users/Envs/lib/python2.7/site-packages/nltk/internals.py", line 82, in config_java
        _java_bin = find_binary('java', bin, env_vars=['JAVAHOME', 'JAVA_HOME'], verbose=verbose, binary_names=['java.exe'])

        File "/Users/Envs/lib/python2.7/site-packages/nltk/internals.py", line 544, in find_binary
            binary_names, url, verbose))
          File "/Users/Envs/lib/python2.7/site-packages/nltk/internals.py", line 538, in find_binary_iter
            url, verbose):
          File "/Users/Envs/lib/python2.7/site-packages/nltk/internals.py", line 517, in find_file_iter
            raise LookupError('nn%sn%sn%s' % (div, msg, div))
        LookupError:
        ===========================================================================
    NLTK was unable to find the java file!
    Use software specific configuration paramaters or set the JAVAHOME environment variable.
    ===========================================================================

我已经设置了java_pathjavahome,我想知道为什么仍然会出现错误?

我的环境是MAC。

问题是java_path,应该是:

java_path = "/your/Java/jdk/home

相关内容

  • 没有找到相关文章

最新更新