【问题标题】:how to import schema in PySpark如何在 PySpark 中导入模式
【发布时间】:2017-05-30 13:21:37
【问题描述】:

对不起,我愚蠢的初学者问题。我尝试导入架构:

from schema import Schema

但我收到一个错误:ImportError: No module named schema

我在这里想念什么?我在 Windows7 上使用 Python 2.7.13 和 Spark 2.1.0。谢谢!

【问题讨论】:

  • PySpark 中没有 schema 模块。
  • @user281707,看看我的回答,告诉我它对你有帮助吗?

标签: python schema pyspark


【解决方案1】:

此 import("from schema import Schema") 语句正在从其他 python 文件中导入一些代码。

你做得很好,但是这个“模式”模块需要在你的 python 代码中使用之前手动安装。

如果您有 windows 平台,只需在 cmd 中运行此命令,否则在 Linux 上您必须在终端上运行它:

pip install schema

就是这样!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-30
    • 2021-04-05
    • 2015-11-08
    • 2020-03-28
    • 2016-12-14
    • 1970-01-01
    • 1970-01-01
    • 2014-06-09
    相关资源
    最近更新 更多