V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
James369
V2EX  ›  Python

如何查看一个软件包(未安装)的依赖包?

  •  
  •   James369 · 2021-05-28 10:10:35 +08:00 · 1729 次点击
    这是一个创建于 1057 天前的主题,其中的信息可能已经有所发展或是发生改变。
    主要是针对未安装的软件包,因为不知道会依赖哪些子包。
    我看了 pip 没有这方面的选项,即使登录 pypi.org 查看软件包,也看不到其依赖的子包。
    如何查看依赖?
    3 条回复    2021-05-28 14:58:10 +08:00
    xiaolinjia
        1
    xiaolinjia  
       2021-05-28 10:41:24 +08:00
    去他的仓库,然后点开 setup.py 或者 requirements.txt 之类的文件,一般里面都有写。
    以 requests 为例,https://github.com/psf/requests/blob/master/setup.py#L43
    requires = [
    'chardet>=3.0.2,<5',
    'idna>=2.5,<3',
    'urllib3>=1.21.1,<1.27',
    'certifi>=2017.4.17'

    ]
    James369
        2
    James369  
    OP
       2021-05-28 10:52:39 +08:00
    @xiaolinjia 不错,虽然有点曲线救国
    Wincer
        3
    Wincer  
       2021-05-28 14:58:10 +08:00
    pip download -r requirements.txt 我一般都这么做,会递归下载所有的依赖
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1480 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:12 · PVG 01:12 · LAX 10:12 · JFK 13:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.