在Ubuntu 18.04

时间:2019-11-30 18:01:50

标签: python pip ubuntu-18.04

我正在尝试在Ubuntu 18.04上使用pip安装pydoop,并不断出现错误“ pydoop的构建轮子失败”。

pip install pydoop
/bin/sh: 1: hadoop: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-zqQz1I/pydoop/setup.py", line 368, in <module>
        zip_safe=False,
      File "/home/andrew/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/home/andrew/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-zqQz1I/pydoop/setup.py", line 320, in run
        self.build_java()
      File "/tmp/pip-build-zqQz1I/pydoop/setup.py", line 301, in build_java
        jb = JavaBuilder(self.build_temp, self.build_lib)
      File "/tmp/pip-build-zqQz1I/pydoop/setup.py", line 199, in __init__
        self.java_libs = [JavaLib()]
      File "/tmp/pip-build-zqQz1I/pydoop/setup.py", line 183, in __init__
        self.classpath = pydoop.hadoop_classpath()
      File "pydoop/__init__.py", line 79, in hadoop_classpath
        return _PATH_FINDER.hadoop_classpath()
      File "pydoop/hadoop_utils.py", line 126, in hadoop_classpath
        "hadoop classpath --glob", shell=True, universal_newlines=True
      File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command 'hadoop classpath --glob' returned non-zero exit status 127

似乎无法识别hadoop命令,但是,只要我在命令行中使用它,就没有问题。我在.bashrc文件中包含了hadoop的路径。

1 个答案:

答案 0 :(得分:0)

如评论中所建议,sh将不会使用.bashrc。尝试将Hadoop二进制文件添加到您的PATH中,例如export PATH="${hadoop_home}/bin:${hadoop_home}/sbin:${PATH}"