簡體   English   中英

在Docker鏡像中安裝python-sympy

[英]Installing python-sympy in a Docker image

我試圖使用Dockerfile在基於Debian的Docker鏡像中安裝Sympy:

FROM  debian:jessie
RUN apt-get update && apt-get install -y \
    python \
    build-essential \
    make \
    gcc \
    pandoc \
    lrslib \
    dos2unix \
    python-dev \
    python-pygments \
    python-numpy \
    python-pip 

RUN  apt-get -y install python-sympy
....

在第二個RUN命令中,APT工具通知我它必須下載900 MB(!)的依賴項,其中大多數是字體。 這沒有任何意義,因為Sympy是純Python包。

然后我嘗試了標准設置:

....
COPY    sympy-0.7.6.tar.gz /sympy-0.7.6.tar.gz
RUN     tar -xzvf /sympy-0.7.6.tar.gz
WORKDIR /sympy-0.7.6
RUN     python setup.py install

這是有效的,但在運行容器中,Sympy會返回我在自己的Linux安裝中看不到的字符串格式錯誤。 感謝任何提示。

我猜那些900MB不是依賴項,而是建議。

$ apt-cache show python-sympy
Package: python-sympy
Priority: optional
Section: universe/python
Installed-Size: 14889
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Georges Khaznadar <georgesk@debian.org>
Architecture: all
Source: sympy
Version: 0.7.4.1-1
Depends: python (>= 2.7), python (<< 2.8), python:any (>= 2.7.1-0ubuntu2)
Recommends: python-imaging, python-ctypes, ipython, python-numpy, texlive-fonts-extra, dvipng
Filename: pool/universe/s/sympy/python-sympy_0.7.4.1-1_all.deb
Size: 2826308
MD5sum: 4bfdb84df0e626f13b46b0d44517a492
SHA1: bcc0a9b24d6f974d3ece4b770fc607f25a9e61f6
SHA256: 3c490be9ab494a37ff4a5f5729f1de261546391acc5377a4b48c40cbee0657fa
Description-en: Computer Algebra System (CAS) in Python
 SymPy is a Python library for symbolic mathematics (manipulation). It aims to
 become a full-featured computer algebra system (CAS) while keeping the code as
 simple as possible in order to be comprehensible and easily extensible. SymPy
 is written entirely in Python and does not require any external libraries,
 except optionally for plotting support.
Description-md5: 6056e6cef6dcfe0106530b41d92b60d5
Homepage: https://github.com/sympy/sympy
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

您可以使用--no-install-recommends選項省略建議,因此可以在Dockerfile使用它:

FROM  debian:jessie
RUN apt-get update && apt-get install -y \
    python \
    build-essential \
    make \
    gcc \
    pandoc \
    lrslib \
    dos2unix \
    python-dev \
    python-pygments \
    python-numpy \
    python-pip 

RUN  apt-get -y --no-install-recommends install python-sympy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM