无法使用一个Docker RUN命令安装多个Python包



我可以使用一个Docker RUN命令安装apt包,比如:

RUN apt-get update && apt-get install -y --no-install-recommends               
gcc                                                                    
build-essential                                                        
zlib1g-dev                                                             
glade                                                                  
python3-dev                                                            
python3-pip                                                            
python3-setuptools                                                     
pkg-config                                                             
libglib2.0-dev                                                         
libgirepository1.0-dev                                                 
libcairo2-dev                                                          
gir1.2-gtk-3.0  

然而,我不能在Docker RUN命令中使用Python pip来做同样的事情,比如:

RUN pip3 install 
wheel 
pycairo 
PyGObject 
requests 
pyinstaller

以错误结束:

Collecting pyinstaller (from -r /tmp/requirements.txt (line 5))
Downloading https://files.pythonhosted.org/packages/b0/e6/e5760666896739115b0e4538a42cdd895215581618ec885ad043dd35ee57/pyinstaller-4.10.tar.gz (2.7MB)
Complete output from command python setup.py egg_info:
Error: Building wheels requires the 'wheel' package. Please `pip install wheel` then try again.

为什么?

尽管我可以做到:

RUN pip3 install wheel                                                         
RUN pip3 install pycairo                                                       
RUN pip3 install PyGObject                                                     
RUN pip3 install requests                                                      
RUN pip3 install pyinstaller 

仍然希望了解为什么它不能在ONE Docker RUN pip安装命令中完成

组合安装的问题

RUN pip3 install 
wheel 
pycairo 
PyGObject 
requests 
pyinstaller

pip在处理完所有列出的程序包之前不会完全安装程序包,并且有些程序包需要wheel已经完全安装。首先单独安装wheel,然后安装其他所有内容:

RUN pip3 install wheel
RUN pip3 install 
pycairo 
PyGObject 
requests 
pyinstaller

wheel是一个特殊的软件包,需要安装其他软件包。