简体   繁体   English

为什么从PyHive包导入配置单元后出现“ImportError:没有名为builtins的模块”?

[英]Why “ImportError: No module named builtins” appears after importing hive from PyHive package?

I have a simple question to ask. 我有一个简单的问题要问。 I have been trying to execute HIVE queries from Python using impyla package. 我一直在尝试使用impyla包从Python执行HIVE查询。 But I stuck into cursor problem , already a question has been asked on stackoverflow. 但我陷入了光标问题 ,已经在stackoverflow上提出了一个问题。 In this question, a user answered and advised to use PyHive instead. 在这个问题中,用户回答并建议使用PyHive

Therefore, now I am trying to execute HIVE queries from Python using PyHive. 因此,现在我尝试使用PyHive从Python执行HIVE查询。 But unluckily, I am stuck at another issue which seems to be not that complicated. 但不幸的是,我陷入了另一个似乎并不那么复杂的问题。 As soon as I execute the following line in python I get an error: 一旦我在python中执行以下行,我就会收到一个错误:

In [18]: from pyhive import hive
Traceback (most recent call last):

  File "<ipython-input-18-747088b97eb4>", line 1, in <module>
    from pyhive import hive

  File "build\bdist.win32\egg\pyhive\hive.py", line 13, in <module>

  File "build\bdist.win32\egg\pyhive\common.py", line 8, in <module>

ImportError: No module named builtins

Can anyone indicate where I am getting it wrong? 任何人都可以指出我错了吗? Since, I have already successfully installed the PyHive package on my machine, so I don't expect this to appear. 因为,我已经在我的机器上成功安装了PyHive软件包,所以我不希望出现这种情况。 I have been searching allot to find a reason of this error. 我一直在寻找分配给这个错误的原因。 It will be really a great time saver if I know the solution today. 如果我今天知道解决方案,那将是一个非常好的节省时间。 Thank you very much for your time and support. 非常感谢您的时间和支持。

UPDATE UPDATE

I am using: 我在用:

  1. Windows 7 (64-bit) Windows 7(64位)
  2. Python 2.7 (32-bit) Python 2.7(32位)
  3. Anaconda2 4.1.1 (32-bit) Anaconda2 4.1.1(32位)

In python 3 the module __builtin__ was renamed to builtins . 在python 3中,模块__builtin__被重命名为builtins

It is possible that you have installed a python 3 package and are trying to run it with python 2. 您可能已经安装了python 3软件包并尝试使用python 2运行它。

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

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