如何在Python3中导入“HdfsClient”?

2024-06-01 07:33:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python的新成员&我正在尝试与Hadoop HDFS系统连接。我得到了下面的参考代码,我试图实现它,但是在导入包时显示了错误。在

from pyarrow import HdfsClient

# Using libhdfs
hdfs = HdfsClient('192.168.0.119', '50070', 'cloudera', driver='libhdfs')

Error: ImportError: cannot import name 'HdfsClient'

我甚至试图用“pip”安装它,但是

Could not find a version that satisfies the requirement HdfsClient (from versi ons: ) No matching distribution found for HdfsClient

然后我试着用“conda”,但又一次

Collecting package metadata: done Solving environment: failed

PackagesNotFoundError: The following packages are not available from current cha nnels:

  • hdfsclient

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

实际上,我正尝试使用以下方法连接色调:

IP地址->192.168.0.119

端口名->50070

用户名->cloudera

密码->;cloudera

但没用。有谁能建议用更好的方式连接它,或者如何在Python3中导入“HdfsClient”包。在


Tags: thefromhttpsimportcomfornotrepo
1条回答
网友
1楼 · 发布于 2024-06-01 07:33:38

HDFSClient已弃用。您可能需要使用pyarrow.hdfs.connect。 另外,请尝试pip freeze查看相关库是否安装在python环境中。 例如

from pyarrow import hdfs
hdfs.connect('192.168.0.119', 50070, 'cloudera', driver='libhdfs')

相关问题 更多 >