运行pig时出错:找不到pig-core-h2.jar执行'ant-dhadopversion=23 jar',然后重试

yhqotfr8  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(736)

所以我昨晚安装了pig,解压了tar,还编辑了我的.bashrc,包括:

  1. export PIG_HOME=/usr/lib/pig/pig-0.12.0
  2. export PATH=$PATH:$PIG_HOME/bin

昨晚我运行了pig-h,运行了一些加载命令,等等。它运行得非常好。今天早上,我尝试运行任何pig命令,它会给我以下错误:

  1. Cannot locate pig-core-h2.jar. do 'ant -Dhadoopversion=23 jar', and try again

所以我试着跑 ant -Dhadoopversion=23 jar 我明白了:

  1. -bash: ant: command not found

我的问题是:为什么它昨晚运行find,但今天早上却不起作用?我做错什么了?还有-我必须重新安装ant吗?我去了/usr/local/bin/没有ant目录。我还运行了ant-version,但没有找到命令。
但为什么昨晚还有用?现在有什么不同?

xuo3flqw

xuo3flqw1#

此错误来自pig二进制文件:

  1. if [ -f $PIG_HOME/pig.jar ]; then
  2. PIG_JAR=$PIG_HOME/pig.jar
  3. else
  4. PIG_JAR=`echo $PIG_HOME/pig-?.!(*withouthadoop).jar`
  5. fi
  6. if [ -n "$PIG_JAR" ]; then
  7. CLASSPATH="${CLASSPATH}:$PIG_JAR"
  8. else
  9. echo "Cannot locate pig.jar. do 'ant jar', and try again"
  10. exit 1
  11. fi

你的变量 $PIG_HOME 因此未定义,并且由于某些原因无法自动设置。只要做:

  1. export PIG_HOME=/path_to_your_pig
展开查看全部

相关问题