Python 获取模块的相关依赖
如果想查看相关模块的相关依赖如何查看?
方法一:pip
我们直接可以用 pip -show <package-name>
1 2 3 4 5 6 7 8 9 10 11 |
In [11]: !pip show python-novaclient Name: python-novaclient Version: 17.2.1 Summary: Client library for OpenStack Compute API Home-page: https://docs.openstack.org/python-novaclient/latest Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: Apache License, Version 2.0 Location: c:\users\lenovo\anaconda3\envs\horizon-env\lib\site-packages Requires: keystoneauth1, oslo.i18n, PrettyTable, oslo.serialization, iso8601, stevedore, pbr, oslo.utils, simplejson Required-by: |
方法二: pipdeptree
pipdeptree模块 需要单独安装
1 2 3 4 5 6 7 |
In [7]: !pip install pipdeptree Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting pipdeptree Downloading https://mirrors.aliyun.com/pypi/packages/5c/3f/4a3e02c283fb7d3084456cbca8d22b790b9e176b4c0075bc38e5abe166c6/pipdeptree-1.0.0-py3-none-any.whl (12 kB) Requirement already satisfied: pip>=6.0.0 in c:\users\lenovo\anaconda3\envs\horizon-env\lib\site-packages (from pipdeptree) (20.2.3) Installing collected packages: pipdeptree Successfully installed pipdeptree-1.0.0 |
pipdeptre -p <package-name>
命令获取模块依赖
1 2 3 4 5 6 7 8 9 10 |
In [9]: !pipdeptree -p requests Warning!! Cyclic dependencies found: * testtools => fixtures => testtools * fixtures => testtools => fixtures ------------------------------------------------------------------------ requests==2.24.0 - certifi [required: >=2017.4.17, installed: 2020.6.20] - chardet [required: >=3.0.2,<4, installed: 3.0.4] - idna [required: >=2.5,<3, installed: 2.10] - urllib3 [required: >=1.21.1,<1.26,!=1.25.1,!=1.25.0, installed: 1.25.10] |
