首页 > 解决方案 > Docker 错误(无法为使用 PEP 517 且无法直接安装的 Pandas 构建轮子)

问题描述

首先,我的环境是

[python ver = 3.8]
[django = 3.1.6]
[pandas = 1.1.3 or (1.2.1) use anything]

我使用pycharm,venv

我想让我的 prj 到 docker-compose build

错误:熊猫的构建轮子失败

Failed to build pandas
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly

所以,我去熊猫指南,我看到:

https://pandas.pydata.org/pandas-docs/stable/development/contributing.html?highlight=head

它说:

python -m venv $env:USERPROFILE\virtualenvs\pandas-dev

# Activate the virtualenv. Use activate.bat for cmd.exe
~\virtualenvs\pandas-dev\Scripts\Activate.ps1

# Install the build dependencies
python -m pip install -r requirements-dev.txt

# Build and install pandas
python setup.py build_ext -j 4
python -m pip install -e . --no-build-isolation --no-use-pep517 

看起来不错,但我不知道如何应用于我的项目,因为我总是只在 venv 中使用 pip。

python -m pip install -e . --no-build-isolation --no-use-pep517 

我该如何使用它?

标签: pythonpandasdocker

解决方案


你使用的是什么基础镜像?如果它适用于您的项目,请尝试显式定义更新版本的 python。例如,

FROM python:3.8-slim-buster

推荐阅读