点冻结和依赖顺序 [英] pip freeze and order of dependencies
问题描述
`pip freeze > requirements.txt`
自动按照明显的字母顺序写我的依赖项,如下所示:-
automatically writes my dependencies in an apparently alphabetically order, like this:-
matplotlib==1.2.0
numpy==1.6.2
pandas==0.9.1
此问题是pip install -r requirements.txt
(当我部署其代码在requirements.txt
中列出的依赖项时)将最终失败,因为matplotlib首先需要安装numpy.
The problem with this is that pip install -r requirements.txt
(when I deploy my code with its dependencies listed in requirements.txt
) will end up failing because matplotlib needs numpy to be installed first.
当我pip freeze
时,如何确保matplotlib在requirements.txt
文件中的
How can I ensure that matplotlib is listed after numpy in the requirements.txt
file when I pip freeze
it?
推荐答案
对于您而言,这并不重要,因为pip
会构建每个需求(针对每个需求调用python setup.py egg_info
),然后全部安装它们.对于您的具体情况,这无关紧要,因为在构建matplotlib
时当前需要安装numpy
.
For your case it does not matter, because pip
builds every requirements (calling python setup.py egg_info
for each) and then install them all. For your specific case, it does not matter, because numpy
is currently required to be installed while building matplotlib
.
这是matplotlib
的问题,他们创建了一个解决方案: https ://github.com/matplotlib/matplotlib/wiki/MEP11
It is a problem with matplotlib
, and they created a proposal to fix it: https://github.com/matplotlib/matplotlib/wiki/MEP11
请在pip问题跟踪器中查看有关此问题的评论: https://github.com/pypa /pip/issues/25
See comments from this issue at pip issue tracker: https://github.com/pypa/pip/issues/25
此问题与在virtualenv中安装pip的Matplotlib要求重复
This question is a duplicate of Matplotlib requirements with pip install in virtualenv.
这篇关于点冻结和依赖顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!