我正在尝试通过
pip install pandas
在我的笔记本电脑上安装 pandas。
环境:
兼容性:
C:\Users\PC>pip install pandas
WARNING: Ignoring invalid distribution -ywin32 (c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages)
Collecting pandas
Using cached pandas-1.4.2.tar.gz (4.9 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21.0 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from pandas) (1.22.4)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from pandas) (2.8.2)
Collecting pytz>=2020.1
Using cached pytz-2022.1-py2.py3-none-any.whl (503 kB)
Requirement already satisfied: six>=1.5 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
Building wheels for collected packages: pandas
Building wheel for pandas (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pandas (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [2010 lines of output]
C:\Users\PC\AppData\Local\Temp\pip-build-env-q3kdt5nb\overlay\Lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
...
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pandas
Failed to build pandas
ERROR: Could not build wheels for pandas, which is required to install pyproject.toml-based projects
我尝试过的:
使用 pandas 1.5.1
仍然可以重现错误感谢@AKX指出,将来没有也可能不会有32位版本的pandas。 查看 GitHub 上的讨论。
Pandas 不需要 Anaconda 才能工作,但根据输出中的
python310-32
,您正在使用 32 位版本的 Python。
Pandas 显然 没有为 Python 3.10 提供 32 位轮子(尽管它们确实为 Python 3.8 和 Python 3.9 提供了 win32 轮子)。 (预建 32 位轮子可能有其他来源,例如Gohlke 的网站。)
换句话说,在该平台上,您需要从源代码安装 Pandas,这可能是一项相当困难的任务,并且无论如何都不能直接在
pip
内完成(正如您通过 error: metadata-generation-failed
注意到的那样)。
如果您的系统能够运行 64 位 Python,您应该切换到它。
在Python 3.10中安装pandas
python -m pip install pandas
下载熊猫轮, 选择适合您操作系统的一个
从绝对路径安装轮子
pip install pandas-1.4.2-cp310-cp310-win32.whl
您已成功安装 pandas 检查一下
import pandas
我遇到的问题是 Microsoft Visualiual 上的错误,之前提到过 pandas 的wheel错误,在使用 pip install 安装 pandas 之前需要该包。现在安装 microsoft visiual 然后使用 pip install panda 然后 pip install transform 我没有错误。