命令:pip install pandas
C:\Users\user>pip install pandas
Collecting pandas
Using cached https://files.pythonhosted.org/packages/d2/81/a1514c993ad8261a2053f356c3ea9a6ad41871a09a8ef9cf46789e371a63/pandas-1.0.3-cp36-cp36m-win_amd64.whl
Collecting numpy>=1.13.3 (from pandas)
Downloading https://files.pythonhosted.org/packages/5c/74/04e9fb4ed91aaca3bf762429c3567c9523c311b1ef615795737e16f3cd23/numpy-1.18.4-cp36-cp36m-win_amd64.whl (12.8MB)
100% |████████████████████████████████| 12.8MB 693kB/s
Collecting pytz>=2017.2 (from pandas)
Downloading https://files.pythonhosted.org/packages/4f/a4/879454d49688e2fad93e59d7d4efda580b783c745fd2ec2a3adf87b0808d/pytz-2020.1-py2.py3-none-any.whl (510kB)
100% |████████████████████████████████| 512kB 900kB/s
Collecting python-dateutil>=2.6.1 (from pandas)
Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2.6.1->pandas)
Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: numpy, pytz, six, python-dateutil, pandas
Successfully installed numpy-1.18.4 pandas-1.0.3 python-dateutil-2.8.1 pytz-2020.1 six-1.14.0
命令:pip list
C:\Users\user>pip list
Package Version
--------------- -------
numpy 1.18.4
pandas 1.0.3
pip 18.1
python-dateutil 2.8.1
pytz 2020.1
setuptools 40.6.2
six 1.14.0
>>> import pandas
Traceback (most recent call last):
File "" , line 1, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 55, in <module>
from pandas.core.api import (
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\api.py", line 29, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\groupby\generic.py", line 60, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\frame.py", line 124, in <module>
from pandas.core.series import Series
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\series.py", line 4572, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\user\AppData\Local\Programs\Python\Python36\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\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\window\__init__.py", line 1, in <module>
from pandas.core.window.ewm import EWM # noqa:F401
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\window\ewm.py", line 5, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: DLL load failed: 找不到指定的模块。
采用pip install pandas安装方式默认会安装最新版,可能会版本不兼容,导致导包出现错误。
适当降低pandas的版本号,先查看当前安装的版本,然后卸载,重新指定版本安装:
C:\Users\user> pip show pandas
Name: pandas
Version: 1.0.3
Summary: Powerful data structures for data analysis, time series,and statistics
Home-page: http://pandas.pydata.org
Author: The PyData Development Team
Author-email: [email protected]
License: BSD
Location: c:\users\user\appdata\local\programs\python\python36\lib\site-packages
Requires: pytz, numpy, python-dateutil
Required-by:
C:\Users\user>pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pandas 1.0.0 1.0.3 wheel
pip 18.1 20.1 wheel
setuptools 40.6.2 46.3.0 wheel
C:\Users\user> pip install pandas==1.0.3
pip install --upgrade pandas
C:\Users\user> pip install pandas==22222222
Collecting pandas==22222
Could not find a version that satisfies the requirement pandas==22222 (from versions: 0.1, 0.2b0, 0.2b1, 0.2, 0.3.0b0, 0.3.0b2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0rc1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0rc1, 0.8.0rc2, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0rc1, 0.19.0, 0.19.1, 0.19.2, 0.20.0rc1, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0rc1, 0.21.0, 0.21.1, 0.22.0, 0.23.0rc2, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0rc1, 0.24.0, 0.24.1, 0.24.2, 0.25.0rc0, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0rc0, 1.0.0, 1.0.1, 1.0.2, 1.0.3)
No matching distribution found for pandas==22222
其中的from versions:就是囊括了所有可用版本。
C:\Users\user>pip uninstall pandas
Uninstalling pandas-1.0.3:
Would remove:
c:\users\user\appdata\local\programs\python\python36\lib\site-packages\pandas-1.0.3.dist-info\*
c:\users\user\appdata\local\programs\python\python36\lib\site-packages\pandas\*
Proceed (y/n)? y
Successfully uninstalled pandas-1.0.3
C:\Users\user>pip install pandas==1.0.0
Collecting pandas==1.0.0
Downloading https://files.pythonhosted.org/packages/b7/6d/3eaa70da7dac8ca1bc5a26d50d94791aec8d346bc1d326c4d240aa64aca6/pandas-1.0.0-cp36-cp36m-win_amd64.whl (8.8MB)
100% |████████████████████████████████| 8.8MB 666kB/s
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\user\appdata\local\programs\python\python36\lib\site-packages (from pandas==1.0.0) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\user\appdata\local\programs\python\python36\lib\site-packages (from pandas==1.0.0) (2020.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\user\appdata\local\programs\python\python36\lib\site-packages (from pandas==1.0.0) (1.18.4)
Requirement already satisfied: six>=1.5 in c:\users\user\appdata\local\programs\python\python36\lib\site-packages (from python-dateutil>=2.6.1->pandas==1.0.0) (1.14.0)
Installing collected packages: pandas
Successfully installed pandas-1.0.0
C:\Users\user>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
没有报错,安装成功!
>>> import pandas
>>> pandas.__version__
'1.0.0'
C:\Users\user>python -V
Python 3.6.8
C:\Users\user>pip -V
pip 18.1 from c:\users\user\appdata\local\programs\python\python36\lib\site-packages\pip (python 3.6)
python -m pip install --upgrade pip
python -m pip uninstall pip
如果觉得文章对您有帮助,欢迎点赞、收藏、评论讨论!