无法导入熊猫(pandas._libs.window.aggregations)

时间:2020-03-19 19:02:58

标签: python python-3.x pandas

我已经花了几个小时来解决这个问题,所以我想是时候问一个人/某人了。

我(认为)我已经卸载了与python相关的所有内容,然后又重新安装了。我刚刚安装了python的最新版本,并使用pip安装了pandas。我也尝试使用anaconda安装它,但是错误仍然存​​在。我也尝试过直接从github安装,但是没有成功。我正在使用Windows 10。

C:\Users\m>python -V
Python 3.8.2

C:\Users\m>pip install pandas
Collecting pandas
  Downloading https://files.pythonhosted.org/packages/07/12/5a087658337a230f4a77e3d548c847e81aa59b332cdd8ddf5c8d7f11c4a1/pandas-1.0.3-cp38-cp38-win32.whl (7.6MB)
     |████████████████████████████████| 7.6MB 3.3MB/s
Collecting pytz>=2017.2 (from pandas)
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
     |████████████████████████████████| 512kB 3.2MB/s
Collecting python-dateutil>=2.6.1 (from pandas)
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
     |████████████████████████████████| 235kB 6.4MB/s
Collecting numpy>=1.13.3 (from pandas)
  Downloading https://files.pythonhosted.org/packages/5d/b3/f3543d9919baa11afc24adc029a25997821f0376e5fab75fdc16e13469db/numpy-1.18.2-cp38-cp38-win32.whl (10.8MB)
     |████████████████████████████████| 10.8MB 6.4MB/s
Requirement already satisfied: six>=1.5 in c:\users\m\appdata\roaming\python\python38\site-packages (from python-dateutil>=2.6.1->pandas) (1.13.0)
Installing collected packages: pytz, python-dateutil, numpy, pandas
Successfully installed numpy-1.18.2 pandas-1.0.3 python-dateutil-2.8.1 pytz-2019.3
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\m>python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\__init__.py", line 55, in <module>
    from pandas.core.api import (
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\api.py", line 29, in <module>
    from pandas.core.groupby import Grouper, NamedAgg
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
    from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 124, in <module>
    from pandas.core.series import Series
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\series.py", line 4572, in <module>
    Series._add_series_or_dataframe_operations()
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations
    from pandas.core.window import EWM, Expanding, Rolling, Window
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in <module>
    from pandas.core.window.ewm import EWM  # noqa:F401
  File "C:\Users\m\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in <module>
    import pandas._libs.window.aggregations as window_aggregations
ImportError: DLL load failed while importing aggregations: The specified module could not be found.

2 个答案:

答案 0 :(得分:10)

我最终尝试使用稍旧的熊猫版本来解决此确切错误。默认安装为1.0.3,因此我备份了几个发行点:

pip uninstall pandas
pip install pandas==1.0.1

那我可以毫无错误地导入熊猫

答案 1 :(得分:2)

在我看来,Pandas 1.0.3没有在DLL中安装DLL。 “库\ site-packages \ pandas_libs \ window”文件夹。

这对我来说很有效:

安装熊猫1.0.1。

然后从安全的地方的文件夹中复制这两个DLL

concrt140.dll
msvcp140.dll

现在更新到熊猫1.0.3

此后,缺少DLL。 将它们移回文件夹,导入运行正常。

相关问题