pip安装pydoop问题

时间:2017-04-04 14:36:18

标签: python hadoop

当我在Ubuntu 16.0.4中安装pydoop时,我收到如下错误:

~$ pip install pydoop
Collecting pydoop
  Using cached pydoop-1.2.0.tar.gz
    Complete output from command python setup.py egg_info:
    using setuptools version 27.2.0
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-Q8VQGn/pydoop/setup.py", line 70, in <module>
        JVM_LIB_PATH, JVM_LIB_NAME = jvm.get_jvm_lib_path_and_name(JAVA_HOME)
      File "pydoop/utils/jvm.py", line 93, in get_jvm_lib_path_and_name
        return os.path.dirname(jvm_path), jvm_lib_name if jvm_path else None
      File "/home/hadoop/anaconda2/lib/python2.7/posixpath.py", line 122, in dirname
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'

JAVA_HOME值为/etc/java-8-openjdk

1 个答案:

答案 0 :(得分:0)

尝试在HDP节点CentOS7上安装pydoop软件包时,我得到了完全相同的错误。

在运行pip安装之前,我将JAVA_HOME手动设置为以下路径。

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin

更多详细信息: 这是将软件包安装到Python 2.7时的错误

 File "/usr/lib64/python2.7/posixpath.py", line 129, in dirname
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'

将软件包安装到3.6时出现错误

 File "/usr/lib64/python3.6/posixpath.py", line 156, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

后来,我发现自己有两个错误。 1.尚未安装JAVA SDK。 2. JAVA_HOME是正确的。安装SDK之后,JAVA_HOME应该是

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64

在那之后,我能够成功安装pydoop。