Crunchbase API包装器pycrunchbase出错

时间:2015-03-20 10:12:25

标签: python

我尝试导入pycrunchbase api包装器,我收到以下错误。

它是一个使用Crunchbase API平台的API包装器

Doc:https://pycrunchbase.readthedocs.org/en/latest/usage.html

Github:https://github.com/ngzhian/pycrunchbase

>>> from pycrunchbase import *

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    from pycrunchbase import *
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/__init__.py", line 1, in <module>
    from .pycrunchbase import (
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/pycrunchbase.py", line 4, in <module>
    from .resource import (
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/__init__.py", line 1, in <module>
    from .acquisition import Acquisition
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/acquisition.py", line 3, in <module>
    from .node import Node
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/node.py", line 3, in <module>
    from .relationship import NoneRelationshipSingleton, Relationship
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/relationship.py", line 3, in <module>
    from .page import Page
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/page.py", line 4, in <module>
    from .pageitem import PageItem
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/pageitem.py", line 58, in <module>
    @six.python_2_unicode_compatible
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'

2 个答案:

答案 0 :(得分:1)

这可能是因为你的操作系统X引用的是旧版本的六,而不是你的pip安装目录。

当您的系统python安装在/ System / Library / [..]中时,

Pip安装在/ Library / [..]中

如果您点击安装六,它可能安装1.9.0,但当你进入你的python控制台,并键入
>>> import six
>>> six.__version__
'1.4.1'
你可能会得到上述内容。

有两种选择......第一种也是最容易实现的是virtualenv。

第二个是去/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python和 $ rm six.py six.pyc 这将强制您的控制台引用您的pip目录而不是您的python目录,并将引用正确的版本。

希望这是有道理的。

答案 1 :(得分:-1)

pycrunchbase模块依赖于sixrequests模块。

pycrunchbase正常工作:

pip install requests six

然后你应该全力以赴!