virtualenv 要求文件 - 检查包是否存在
我有一个需求文件,其中许多库都不存在。要修剪文件,我需要: -pip install -r 要求.txt - 查看哪个库失败 - 从requirements.txt中删除库 - 重复该过程
对于 80 多个文件来说这可能非常乏味,其中大约三个库中的每个库都失败了...有没有办法对需求文件运行预检查,获取不存在的库/版本的列表?
谢谢
I have a requirements file, where many of the libraries do not exist. To prune the file, I need to:
- pip install -r requirements.txt
- see which library fails
- delete the library from requirements.txt
- repeat the process
This can be very tedious for 80+ files, where every lib in three or so fails... Is there a way to run a pre-check on the requirements file, obtaining a list of non-existent libraries/versions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了检查是否已安装软件包的代码:
http://code.activestate.com/recipes/440501-list-information-about-installed-python-packages-a/
也许你可以从这里得到一些东西。
干杯,
斯特
i found the code to check if a package is installed at this link:
http://code.activestate.com/recipes/440501-list-information-about-installed-python-packages-a/
maybe you can get something out from here.
cheers,
Ste
我希望这还不算太晚:
我做了一个脚本,它将尝试安装requirements.txt中的每个包,如果它可以安装该包,它会将包名称添加到名为“existent.txt”的文件中。因此,现有包的列表将位于“existent.txt”中。
您可以将其放入 file.sh 中以便每次需要时执行。
I hope that is not to late:
I did a script that will try to install every package in the requirements.txt, if it can install the package it'll add the package name into a file named "existent.txt". So the list of the the existent packages will be in the "existent.txt".
you can put this in a file.sh to execute every time you want.