简体   繁体   English

Pip 安装 - 构建轮子时如何锁定 python lib 版本?

[英]Pip Installation - How to lock a python lib version when building a wheel?

Question: How do I force pip wheel building to use a particular package?问题:如何强制 pip 轮构建使用特定的包?

Full background:完整背景:

I have a project with setup.py with a set of libs with versions locked down.我有一个带有 setup.py 的项目,其中包含一组锁定版本的库。

Libs are something like this (shortened for conciseness):库是这样的(为了简洁而缩短):

cffi==1.15.0
<some_other_pkg>=1.0.0
<lots of other packages>

When some_other_pkg installs, pip attempts to build the wheel for this package it uses cffi==1.15.1 .some_other_pkg安装时,pip 尝试为它使用cffi==1.15.1的这个包构建轮子。 I would have expected this to use 1.15.0 when building the wheel given the above.鉴于上述情况,我希望在构建轮子时使用1.15.0

This is a problem for me as my server can't run with cffi==1.15.1 .这对我来说是个问题,因为我的服务器无法使用cffi==1.15.1运行。

How can I instruct pip to use cffi==1.15.0 in the pip wheel building as part of the pip install requirements.pip ?我如何指示 pip 在 pip 轮构建中使用cffi==1.15.0作为 pip install requirements.pip 的一部分?

Further details: using python3, virtualenv, pip, setuptools更多细节:使用 python3、virtualenv、pip、setuptools

Thanks谢谢

I solved this yesterday by doing the following:我昨天通过执行以下操作解决了这个问题:

  1. Creating the venv创建 venv
  2. pip install cibffi==1.15.0 pip install cibffi==1.15.0
  3. Installing my project via: pip install .通过以下方式安装我的项目: pip install . in the dir with the setup.py file.在带有 setup.py 文件的目录中。

The above forced the building of wheels to utilise cibffi==1.15.0 instead of the newer version and so no issues relating to missing unix pkg libffi-devel.以上强制轮子的构建使用 cibffi==1.15.0 而不是较新的版本,因此没有与缺少 unix pkg libffi-devel 相关的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM