pip:安装依赖项的依赖项 [英] pip: install dependencies of dependencies

查看:181
本文介绍了pip:安装依赖项的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想手动安装我正在编写的Python软件包的所有要求.为此,我创建了文件requirements.txt并逐行添加了依赖项:

I would like to manually install all the requirements of a Python package I'm writing. To this end, I created the file requirements.txt and added the dependencies, line by line:

$ cat requirements.txt
meshio
numpy

运行时

$ pip install -r requirements.txt

可以正确安装这两个软件包,但是我注意到并没有对meshio进行依赖(即requirements.txt中列出的所有内容).不足为奇,点子应该怎么知道?

those two packages are installed alright, but I noticed that the dependencies of meshio aren't (i.e., whatever is listed in its requirements.txt). Not surprising, how is pip supposed to know?

是否有一种机制可以通过pip安装整个依赖关系树?

Is there a mechanism for installing the entire dependency tree with pip?

推荐答案

要安装依赖项,软件包需要将其依赖项列出为

Turns out for the dependencies to be installed, the packages needs to list its dependencies as

install_requires=[
    'numpy',
    'pyyaml'
    ],

setup.pysetup()的一部分,而不是requirements.txt中的

as part of setup() in setup.py, not in requirements.txt.

这篇关于pip:安装依赖项的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆