获取编译错误-取决于ORC二进制文件。
In file included from src/_pyorc/_pyorc.cpp:1:
src/_pyorc/Reader.h:7:10: fatal error: 'orc/OrcFile.hh' file not found
#include "orc/OrcFile.hh"
^~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
如果我也分别编译 apache-orc ,那么我该如何将其引用给PyOrc Pip安装?任何人都有任何解决方案或想法,我们如何才能在 Alpine 容器中安装 pyorc 软件包。
我在使用ubuntu的 Alpine 图像和正常的python docker图像工作正常时遇到问题。
Docker镜像:
FROM python:3.7-alpine
最佳答案
我使用了Docker多阶段构建:
# Dockerfile
FROM python:3.7.3
WORKDIR /app
RUN pip install pyorc -t .
FROM python:3.7.3-alpine
WORKDIR /app
RUN apk add --no-cache --virtual .build-deps g++ musl-dev gcompat
COPY --from=0 /app .
似乎可行:$ docker build -t test .
$ docker run -it --rm test python
Python 3.7.3 (default, Jun 27 2019, 22:53:21)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyorc
>>>
>>> with open("./new_data.orc", "wb") as data:
... with pyorc.Writer(data, "struct<col0:int,col1:string>") as writer:
... writer.write((1, "ORC from Python"))
...
>>> from pathlib import Path
>>> Path("./new_data.orc").read_bytes()
b'ORC\x1d\x00\x00\n\x0c\n\x04\x00\x00\x.....'
关于python - 无法在 Alpine Docker容器上安装pyorc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62597014/