我正在尝试使用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 client
和from hdfs import config
,它们分别产生ModuleNotFoundError: No module named 'ConfigParser'
和ImportError: cannot import name 'config' from 'hdfs'
。
我正在使用poetry进行包管理,并且我已经重新运行了poetry lock
和poetry install
,但没有结果。pyproject.toml
文件列出了hdfs = "^1.0.1"
。我有一个hdfscli.cfg文件,它比试图访问它的脚本高出几层。
1条答案
按热度按时间wz8daaqr1#
再次运行
poetry remove hdfs
、poetry add hdfs
、poetry lock
和poetry install
似乎已经解决了这个问题。pyproject.toml
文件现在列出了hdfs = "^2.7.0"
,所以我可能刚刚有一个相当旧的hdfs版本。