我必须以以下方式安装python软件包,
pip install --no-binary=protobuf protobuf
Run Code Online (Sandbox Code Playgroud)
但是,如何写requirements.txt用--no-binary=protobuf?
hoe*_*ing 20
把我的评论变成答案:
pip支持从需求文件中读取选项。这意味着需求文件
protobuf
--no-binary=protobuf
Run Code Online (Sandbox Code Playgroud)
是有效的需求行,与例如由单行组成的文件相同
protobuf --no-binary=protobuf
Run Code Online (Sandbox Code Playgroud)
这意味着您还可以引用其他需求文件,例如
# requirements.txt
-r test_requirements.txt
spam eggs
Run Code Online (Sandbox Code Playgroud)
但是请注意,这pip install -r requirements.txt大致相当于 running cat requirements.txt | xargs pip,因此选项应用于整个命令,而不是单个行或文件。例如,此文件定义了冲突选项:
# requirements.txt
spam --no-binary=eggs
bacon --only-binary=eggs
Run Code Online (Sandbox Code Playgroud)
尝试从此需求文件进行安装将导致错误。
| 归档时间: |
|
| 查看次数: |
869 次 |
| 最近记录: |