0

我正在尝试在 OSX 10.13.6、Python 2.7、Java 1.6 上安装 PyLucene 8.1.1。

我的makefile如下:

VERSION=8.1.1
LUCENE_VER=8.1.1
PYLUCENE:=$(shell pwd)
LUCENE_SRC=lucene-java-$(LUCENE_VER)
LUCENE=$(LUCENE_SRC)/lucene
ANT=JAVA_HOME=/usr/local/bin/ant
PYTHON=/Users/ericaguo/miniconda3/bin/python
JCC=$(PYTHON) -m jcc --shared
NUM_FILES=10

我的 bash 文件如下:

export CLASSPATH=$CLASSPATH:/Users/ericaguo/Desktop/cs015/cs015.jar:.:..

# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

# added by Miniconda3 4.2.12 installer
export PATH="/Users/ericaguo/miniconda3/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

# if which jenv > /dev/null; then eval "$(jenv init -)"; fi

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/ericaguo/google-cloud-sdk/path.bash.inc' ]; then . '/Users/ericaguo/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/ericaguo/google-cloud-sdk/completion.bash.inc' ]; then . '/Users/ericaguo/google-cloud-sdk/completion.bash.inc'; fi
export PATH=$PATH:/usr/local/mysql/bin

当我运行 make 时,这是我的终端输出:

Ericas-MacBook-Air:pylucene-8.1.1 ericaguo$ make
cd lucene-java-8.1.1/lucene; (JAVA_HOME=/usr/local/bin/ant ivy-availability-check || JAVA_HOME=/usr/local/bin/ant ivy-bootstrap)
/bin/sh: ivy-availability-check: command not found
/bin/sh: ivy-bootstrap: command not found
make: *** [ivy] Error 127

当我运行 make install 时,这是我的终端输出:

Ericas-MacBook-Air:pylucene-8.1.1 ericaguo$ make install
/Users/ericaguo/miniconda3/bin/python -m jcc --shared --jar lucene-java-8.1.1/lucene/build/core/lucene-core-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/analysis/common/lucene-analyzers-common-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/backward-codecs/lucene-backward-codecs-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/classification/lucene-classification-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/codecs/lucene-codecs-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/expressions/lucene-expressions-8.1.1.jar --jar build/jar/extensions.jar --jar lucene-java-8.1.1/lucene/build/facet/lucene-facet-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/grouping/lucene-grouping-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/highlighter/lucene-highlighter-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/join/lucene-join-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/analysis/kuromoji/lucene-analyzers-kuromoji-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/memory/lucene-memory-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/misc/lucene-misc-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/analysis/nori/lucene-analyzers-nori-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/queries/lucene-queries-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/queryparser/lucene-queryparser-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/sandbox/lucene-sandbox-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/spatial3d/lucene-spatial3d-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/spatial/lucene-spatial-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/analysis/stempel/lucene-analyzers-stempel-8.1.1.jar --jar lucene-java-8.1.1/lucene/build/suggest/lucene-suggest-8.1.1.jar  --use_full_names --include lucene-java-8.1.1/lucene/expressions/lib/antlr4-runtime-4.5.1-1.jar --include lucene-java-8.1.1/lucene/expressions/lib/asm-5.1.jar --include lucene-java-8.1.1/lucene/expressions/lib/asm-commons-5.1.jar --include lucene-java-8.1.1/lucene/facet/lib/hppc-0.8.1.jar --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.util.Collections java.util.HashMap java.util.HashSet java.util.TreeSet java.lang.IllegalStateException java.lang.IndexOutOfBoundsException java.util.NoSuchElementException java.text.SimpleDateFormat java.text.DecimalFormat java.text.Collator --package java.util.concurrent java.util.concurrent.Executors --package java.util.regex --package java.io java.io.StringReader --package java.nio.file java.nio.file.Path java.nio.file.Files java.nio.file.Paths --exclude org.apache.lucene.sandbox.queries.regex.JakartaRegexpCapabilities --exclude org.apache.regexp.RegexpTunnel --exclude org.apache.lucene.store.WindowsDirectory --exclude org.apache.lucene.store.NativePosixUtil --python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --sequence java.util.AbstractCollection 'size:()I' '-:-' --sequence java.util.AbstractList '-:-' 'get:(I)Ljava/lang/Object;' org.apache.lucene.index.IndexWriter:getReader org.apache.lucene.analysis.Tokenizer:input --version 8.1.1 --module python/collections.py --module python/ICUNormalizer2Filter.py --module python/ICUFoldingFilter.py --module python/ICUTransformFilter.py  --files 10 --install  
Traceback (most recent call last):
  File "/Users/ericaguo/miniconda3/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/ericaguo/miniconda3/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/ericaguo/miniconda3/lib/python2.7/site-packages/JCC-3.6-py2.7-macosx-10.7-x86_64.egg/jcc/__main__.py", line 107, in <module>
    cpp.jcc(sys.argv)
  File "/Users/ericaguo/miniconda3/lib/python2.7/site-packages/JCC-3.6-py2.7-macosx-10.7-x86_64.egg/jcc/cpp.py", line 626, in jcc
    egg_info, extra_setup_args)
  File "/Users/ericaguo/miniconda3/lib/python2.7/site-packages/JCC-3.6-py2.7-macosx-10.7-x86_64.egg/jcc/python.py", line 1759, in compile
    copytree(os.path.join(output, extname), 'include')
  File "/Users/ericaguo/miniconda3/lib/python2.7/site-packages/JCC-3.6-py2.7-macosx-10.7-x86_64.egg/jcc/python.py", line 1747, in copytree
    for name in os.listdir(src):
OSError: [Errno 20] Not a directory: 'build/_lucene'
make: *** [install] Error 1
4

1 回答 1

0

ANT=JAVA_HOME=/usr/local/bin/ant可能应该阅读ANT=/usr/local/bin/ant.

make当前执行的调用是(JAVA_HOME=/usr/local/bin/ant ivy-availability-check || JAVA_HOME=/usr/local/bin/ant ivy-bootstrap). 这是一个 shell 调用,解释为:

  1. 设置环境变量JAVA_HOME=/usr/local/bin/ant
  2. 调用程序ivy-availability-check

同上ivy-bootstrap。这些似乎是ant程序调用的目标,因此这里JAVA_HOME不应该使用它。

于 2020-02-24T21:45:08.340 回答