简体   繁体   English

如何在HDFS中使用python读取.pkl文件

[英]How to read .pkl file using python in hdfs

I'm using Python 3.5.2 in IBM cloud. 我在IBM Cloud中使用Python 3.5.2。 I need to run a pyspark code in cluster environment. 我需要在集群环境中运行pyspark代码。 For this work I need to upload pickle file in hdfs using python. 为此,我需要使用python在hdfs中上载pickle文件。 I saw the comments here 我在这里看到了评论

I want to upload terrs.pkl. 我要上传terrs.pkl。 The file location is given in attached screen shot 文件位置在随附的屏幕截图中给出 在此处输入图片说明

I'm using following command as per the suggestion given in the link that I shared 我根据共享链接中给出的建议使用以下命令

pickle.load( open( '/user/clsadmin/terrs.pkl', "rb" ) )

But it's throwing error that 但这引发了错误

No such file or directory: '/user/clsadmin/terrs.pkl'

Please refer the attached screen shot. 请参考所附的屏幕截图。 在此处输入图片说明 Can you suggest me how do I load this .pkl file using python? 您能建议我如何使用python加载此.pkl文件吗?

open_file = open("/user/clsadmin/terrs.pkl", "rb")
data = pickle.load(open_file)
open_file.close()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM