导入panda和numpy时出现错误

python错误

导入panda和numpy时出现如下错误

import pandas as pd
import numpy as np
Traceback (most recent call last):
  File "F:\Python 3.7\lib\site-packages\pandas\__init__.py", line 26, in 
    from pandas._libs import (hashtable as _hashtable,
  File "F:\Python 3.7\lib\site-packages\pandas\_libs\__init__.py", line 4, in 
    from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
ModuleNotFoundError: No module named 'pandas._libs.tslib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "F:\Python 3.7\lib\site-packages\pandas\__init__.py", line 35, in 
    "the C extensions first.".format(module))
ImportError: C extension: No module named 'pandas._libs.tslib' 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.

解决方案

卸载pandas和numpy,重新安装

pip uninstall numpy
pip uninstall pandas

你可能感兴趣的:(Python,数据分析)