从requirements.txt中安装车轮

St.*_*rio 6 python pip python-3.x python-venv python-wheel

我正在尝试配置我requirements.txt的以下内容:

wheel
apache-airflow
Run Code Online (Sandbox Code Playgroud)

我创建python3.8 -m venv ~/test-env并尝试进行安装。问题是

python -m pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)

产生大量消息

error: invalid command 'bdist_wheel'                                                                                                                                                                                            

----------------------------------------                                                                                                                                                                                        
Failed building wheel for thrift        
Run Code Online (Sandbox Code Playgroud)

我确保wheel在安装时requirements.txt安装了它:

Collecting wheel (from -r requirements.txt (line 1))                                                                                                                                                                              
Using cached https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.
Run Code Online (Sandbox Code Playgroud)

但是如果我单独安装

python -m pip install wheel
python -m pip install -r requirements
Run Code Online (Sandbox Code Playgroud)

它工作正常,并且python -m pip -r requirements没有错误消息。

那么是不是可以将wheel安装放入requirements.txt?安装时处理它的正确方法是什么venv?安装前要requirements.txt安装吗?

sin*_*roc 5

我相信旧版本的pip会发生这种情况。例如,在我的快速测试中,它发生在pip 9.0.1 中,它默认与Python 3.6ensurepip标准库一起提供,但是一旦pip更新到19.2.3就不会发生,据我所知应该与蟒蛇 3.8。您似乎在使用 Python 3.8,所以我对您遇到此错误的事实感到困惑。无论如何这个错误,不应该有效地阻止需求的实际安装。

如果可能,我建议更新 pip:

python -m pip install --upgrade pip

在安装要求之前:

python -m pip install --requirement requirements.txt

在这种情况下,从需求文件中安装wheel(或更新pip)没有用。