【发布时间】:2020-10-19 07:03:14
【问题描述】:
当你使用pipenv 安装一个包时,所有依赖的包也会随之安装。使用pipenv uninstall 卸载该软件包不会自动删除相关软件包。
如何在 pipenv 中获得 pip-autoremove 的等效功能?
例如:
$ cd testpipenv
$ pipenv install requests
$ pipenv shell
(testpipenv) $ pipenv graph
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.9]
(testpipenv) $ pipenv uninstall requests
(testpipenv) $ pip list
Package Version
---------- ---------
certifi 2020.6.20
chardet 3.0.4
idna 2.10
pip 20.1.1
setuptools 47.3.1
urllib3 1.25.9
wheel 0.34.2
requests的依赖包,如urllib3,仍然安装,可以通过验证
(testpipenv) $ python
>>> import urllib3
这也在这里讨论过:Pipenv uninstall doesn't uninstall dependencies - issue #1470,我还没有找到关于使用 pipenv 自动删除软件包的最新指令集。
使用的版本:
- pipenv,版本 2020.5.28
- Python 3.6.10
【问题讨论】:
-
感谢您的链接,但它不适用于这个问题,我在该问题中专门询问了关于在 pipenv 中执行
pip-autoremovewithin 的等效操作。不建议使用不考虑 pipenv 的 pip 命令或类似命令。 - 链接pipdeptree中的另一个命令与pipenv graph类似,它会显示依赖关系树,但不会自动删除未使用的包。
标签: python python-3.x pip uninstallation pipenv