无法从hdfscli导入Python hdfs客户端或配置模块

utugiqy6  于 2023-06-20  发布在  HDFS
关注(0)|答案(1)|浏览(197)

我正在尝试使用hdfscli库创建一个Python 3 HDFS客户端。根据文件我试过

import hdfs

client = hdfs.config.Config().get_client("dev")

得到AttributeError: module 'hdfs' has no attribute 'config'
我试过了

import hdfs

client = hdfs.client.InsecureClient("http://<target/IP/address/>")

其产生AttributeError: module 'hdfs' has no attribute 'client'
我还尝试了from hdfs import clientfrom hdfs import config,它们分别产生ModuleNotFoundError: No module named 'ConfigParser'ImportError: cannot import name 'config' from 'hdfs'
我正在使用poetry进行包管理,并且我已经重新运行了poetry lockpoetry install,但没有结果。pyproject.toml文件列出了hdfs = "^1.0.1"。我有一个hdfscli.cfg文件,它比试图访问它的脚本高出几层。

wz8daaqr

wz8daaqr1#

再次运行poetry remove hdfspoetry add hdfspoetry lockpoetry install似乎已经解决了这个问题。pyproject.toml文件现在列出了hdfs = "^2.7.0",所以我可能刚刚有一个相当旧的hdfs版本。

相关问题