解决debian ubuntu apt install 和 apt-get install 依赖问题

最近在制作raspberry-pi 关于opencv4.10 python3.7 相关镜像时,
涉及到了Debian 系统, 里面需要安装很多相关的包,然后进行编译。
其中apt install 或 apt-get install 这个环节真是让人崩溃,总是遇到包冲突或包版本不对,
尝试了网上很多方法,没有一个能彻底解决。综合起来,总结了国外各种解决方式,得到了一个可行的解决办法:

#ubuntu debian 安装包冲突时,直接根据提示安装指定的版本,然后加上 --allow-downgrades
RUN apt-get install --allow-downgrades libjbig0=2.1-3.1 liblzma5=5.2.2-1.2

#libgtk2.0-dev : Depends: libpango1.0-dev>= 1.20 but it is not going to be installed
#                 Depends: libcairo2-dev>= 1.6.4-6.1 but it is not going to be installed
#                 Depends: libxext-dev>= 1:1.0.1-2 but it is not going to be installed
#                 Depends: libxinerama-dev (>= 1:1.0.1-4.1 but it is not going to be installed
#                 Depends: libxi-dev>= 1:1.0.1-4 but it is not going to be installed
#                 Depends: libxrandr-dev>= 2:1.2.99 but it is not going to be installed
#                 Depends: libxcomposite-dev>= 1:0.2.0-3 but it is not going to be installed
# qt5-default : Depends: qtbase5-dev but it is not going to be installed

#The following packages have unmet dependencies:
# libcairo2-dev : Depends: libfontconfig1-dev (>= 2.2.95) but it is not going to be installed
# libpango1.0-dev : Depends: libfontconfig1-dev (>= 2.10.91) but it is not going to be installed
#                   Depends: libxft-dev but it is not going to be installed
# libxext-dev : Depends: libxext6 (= 2:1.3.3-1) but 2:1.3.3-1+b2 is to be installed

#The following packages have unmet dependencies:
# libfontconfig1-dev : Depends: libfontconfig1 (= 2.11.0-6.7) but 2.11.0-6.7+b1 is to be installed
# libxext-dev : Depends: libxext6 (= 2:1.3.3-1) but 2:1.3.3-1+b2 is to be installed

RUN apt install -y --allow-downgrades \
    libfontconfig1=2.11.0-6.7 \
    libxext6=2:1.3.3-1 \
    libpango1.0-dev \
    libcairo2-dev\
    libxext-dev \
    libxinerama-dev  \
    libxi-dev  \
    libxrandr-dev  \
    libxcomposite-dev  \
    qtbase5-dev \
    libfontconfig1-dev \
    libxft-dev

你可能感兴趣的:(常见IT基础,经验分享)