我知道有很多与此相关的问题,但没有人能回答我,因为他们都在使用Anaconda或Unix环境。
我安装了适用于Windows7的Python3.7.1,以及带有pip
的pandas 0.23.4。所以我所做的不过是import pandas as pd
(通过jupyter和console),它会输出以下内容
---------------------------------------------------------------------------
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.
谁能告诉我如何克服这个问题?可能错误消息建议听起来很明显,但我只是不理解它,所以如果有人一步一步地解释它,我将不胜感激。
发布于 2020-07-22 21:44:45
遵循从github克隆的熊猫上建议的setup.com程序。这需要一个Cython的pip --update
。(site_packages/pandas中没有setup.com )。
然后我卸载并重新安装了pandas。很高兴报告这个问题已经解决了!
https://stackoverflow.com/questions/53714030
复制相似问题