首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >导入pandas时出现C扩展错误

导入pandas时出现C扩展错误
EN

Stack Overflow用户
提问于 2018-12-11 05:37:52
回答 1查看 868关注 0票数 1

我知道有很多与此相关的问题,但没有人能回答我,因为他们都在使用Anaconda或Unix环境。

我安装了适用于Windows7的Python3.7.1,以及带有pip的pandas 0.23.4。所以我所做的不过是import pandas as pd (通过jupyter和console),它会输出以下内容

代码语言:javascript
运行
复制
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
c:\users\4217109\appdata\local\programs\python\python37-32\lib\site-packages\pandas\__init__.py in <module>
     25 try:
---> 26     from pandas._libs import (hashtable as _hashtable,
     27                              lib as _lib,

c:\users\4217109\appdata\local\programs\python\python37-32\lib\site-packages\pandas\_libs\__init__.py in <module>
      3 
----> 4 from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
      5 

ImportError: cannot import name 'iNaT' from 'pandas._libs.tslib' (unknown location)

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-2-3d5cd439516e> in <module>
----> 1 import pandas as pd
      2 from datetime import date, datetime
      3 import calendar

c:\users\4217109\appdata\local\programs\python\python37-32\lib\site-packages\pandas\__init__.py in <module>
     33                       "pandas from the source directory, you may need to run "
     34                       "'python setup.py build_ext --inplace --force' to build "
---> 35                       "the C extensions first.".format(module))
     36 
     37 from datetime import datetime

ImportError: C extension: 'iNaT' from 'pandas._libs.tslib' (unknown location) not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.

谁能告诉我如何克服这个问题?可能错误消息建议听起来很明显,但我只是不理解它,所以如果有人一步一步地解释它,我将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2020-07-22 21:44:45

遵循从github克隆的熊猫上建议的setup.com程序。这需要一个Cython的pip --update。(site_packages/pandas中没有setup.com )。

然后我卸载并重新安装了pandas。很高兴报告这个问题已经解决了!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53714030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档