pip install pygraphviz: No package 'libcgraph' found

前端 未结 6 1040
醉梦人生
醉梦人生 2021-01-31 01:20

I succeed in installing graphviz and cgraph with

$ sudo pip install graphviz
....
Successfully installed graphviz-0.5.1

$ sudo pip ins         


        
6条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 02:00

    I ran into this problem when creating a Dockerfile for Django with a python-alpine image.

    I was able to solve it thanks to this post adding the package "graphviz-dev" along with the rest of my app's dependencies.

    Example:

    #Install dependencies
    RUN apk add --update --no-cache --virtual .build-deps \
        build-base \
        alpine-sdk \
        postgresql-dev \
        libffi-dev \
        python3-dev \
        libffi-dev \
        jpeg-dev \
        zlib-dev \
        musl-dev \
        libpq \
        graphviz-dev \  
        && pip install --no-cache-dir -r /code/requirements_dev.txt \
        && find /usr/local \
            \( -type d -a -name test -o -name tests \) \
            -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
            -exec rm -rf '{}' +
    

    Regards

提交回复
热议问题