1. 程式人生 > >匯入panda和numpy時出現錯誤

匯入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 <module>
    from pandas._libs import (hashtable as _hashtable,
  File "F:\Python 3.7\lib\site-packages\pandas\_libs\__init__.py", line 4, in <module>
    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 "<stdin>", line 1, in <module>
  File "F:\Python 3.7\lib\site-packages\pandas\__init__.py", line 35, in <module>
    "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