pandas 熊猫的开发构建给出了导入错误:C 扩展名:'hashtable' 不是基于 python 3.4 (anaconda) 构建的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31495657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 23:38:30  来源:igfitidea点击:

Development build of pandas giving importerror: C extension: 'hashtable' not built on python 3.4 (anaconda)

pythonpython-3.xpandas

提问by nick_eu

Try to do a development build with 3.4 (have previously managed in 2.7). Python is just an anaconda installation on osx10.10. I can get

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

I:

一世:

  • git cloned pandas
  • ran python setup.py build_ext --inplace (got no errors)
  • ran python setup.py develop.
  • git 克隆Pandas
  • 运行 python setup.py build_ext --inplace(没有错误)
  • 运行 python setup.py 开发。

But when I try and import pandas I get:

但是当我尝试导入Pandas时,我得到:

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.

Note that when I do build_ext I get the following (apparently fine) output:

请注意,当我执行 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)

Further, I can get pandas installed if I run conda install pandas, but would really like a development environment for code development.

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

Similar to this, which looked unsolvedand this

与此类似,这看起来未解决,

采纳答案by nick_eu

The answer, due to @chrisb in comments, was to run python setup.py build_ext --inplace --force.

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

回答by neves

I solved it reinstalling pandas with this command:

我使用以下命令解决了重新安装Pandas的问题:

conda install pandas

Everything was working fine, but I installed something using pip and started having problems. This solved it.

一切正常,但我使用 pip 安装了一些东西并开始出现问题。这解决了它。