开发构建的pandas给出了importerror:C扩展:' hashtable'不是建立在python 3.4(anaconda)

时间:2015-07-18 21:15:48

标签: python python-3.x pandas

尝试使用3.4进行开发构建(之前已在2.7中进行过管理)。 Python只是osx10.10上的anaconda安装。我可以得到

I:

  • git cloned pandas
  • 运行python setup.py build_ext --inplace(没有错误)
  • 运行python setup.py develop。

但是当我尝试导入大熊猫时,我得到了:

import pandas as pd
Traceback (most recent call last):

  File "<ipython-input-2-af55e7023913>", line 1, in <module>
    import pandas as pd

  File "/Users/Nick/github/pandas/pandas/__init__.py", line 13, in <module>
    "extensions first.".format(module))

ImportError: C extension: 'hashtable' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

请注意,当我执行build_ext时,我得到以下(显然很好)输出:

pandas(master)$python setup.py build_ext --inplace

running build_ext
skipping 'pandas/index.c' Cython extension (up-to-date)
skipping 'pandas/lib.c' Cython extension (up-to-date)
skipping 'pandas/parser.c' Cython extension (up-to-date)
skipping 'pandas/src/period.c' Cython extension (up-to-date)
skipping 'pandas/hashtable.c' Cython extension (up-to-date)
skipping 'pandas/algos.c' Cython extension (up-to-date)
skipping 'pandas/tslib.c' Cython extension (up-to-date)
skipping 'pandas/src/sparse.c' Cython extension (up-to-date)
skipping 'pandas/src/testing.c' Cython extension (up-to-date)
skipping 'pandas/msgpack.cpp' Cython extension (up-to-date)

此外,如果我运行conda install pandas,我可以安装pandas,但是我真的很喜欢代码开发的开发环境。

Similar to this, which looked unsolvedthis

2 个答案:

答案 0 :(得分:8)

由于评论中的@chrisb,答案是运行python setup.py build_ext --inplace --force

答案 1 :(得分:1)

我用这个命令解决了重新安装pandas的问题:

conda install pandas

一切都运行正常,但我使用pip安装了一些东西并开始遇到问题。这解决了它。