我正在尝试配置我的 requirements.txt
,如下所示:
wheel
apache-airflow
我创建了python3.8 -m venv ~/test-env
并尝试进行安装。问题是
python -m pip install -r requirements.txt
产生大量消息
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for thrift
我确保在安装 requirements.txt
时安装了 wheel
:
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.
但是如果我单独安装
python -m pip install wheel
python -m pip install -r requirements
它工作正常,python -m pip -r requests
完成时没有错误消息。
那么是否可以将wheel
安装放入requirements.txt
中?安装到 venv
时处理它的正确方法是什么?要在安装 requirements.txt
之前安装它?
最佳答案
我相信旧版本的 pip 会发生这种情况。例如,在我的快速测试中,pip 9.0.1 就发生了这种情况,默认情况下,它是通过 Python 3.6 的 ensurepip 标准库提供的,但它并没有一旦pip更新到19.2.3,据我所知应该与Python 3.8捆绑在一起。您似乎使用的是 Python 3.8,所以我对您遇到此错误的事实感到困惑。无论如何,这个错误不应有效地阻止需求的实际安装。
如果可能的话,我建议更新 pip:
python -m pip install --upgrade pip
安装要求之前:
python -m pip install --requirement requests.txt
在这种情况下,从需求文件中安装wheel(或更新pip)是没有用的。
关于python - 从requirements.txt中安装轮子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59104686/