2016-05-26 81 views
2

这就像是一个简单的问题,但我找不到任何参考文献pip documentationthe only question that seemed relevant提到一个标志,自从版本1.5(版本8.1在撰写本文时为最新版本)以来显然已被弃用。如何“假装”使用pip安装软件包?

如何“伪装”使用pip安装软件包或软件包列表,而不实际安装它们?我有这两个独立的用例:

  • 我需要看什么包了一个长(〜70行)requirements.txt的缺失,而无需实际安装它们;看到什么需求已经满足,没有安装缺少的需求就能满足这个需求。
  • 找到我尚未安装在计算机上的软件包的依赖关系,而无需使用Portage或Aptitude之类的软件。

回答

1

还有一个非常有用的pip-tools package,提供了一个pip-review工具,你可以在“预演”模式,对你的要求文件(S)执行:

$ mkvirtualenv test_so 
New python executable in test_so/bin/python 
Installing setuptools, pip, wheel...done. 
... 
(test_so) $ pip install pip-tools 
... 
Installing collected packages: six, click, first, pip-tools 
(test_so) $ echo "Django==1.6.11" > requirements.txt 
(test_so) $ pip-sync --dry-run requirements.txt 
Would install: 
    Django==1.6.11 

而且,这里是部分相关的线程:Check if requirements are up to date

-2

根据pip文档,生成requirements.txt文件的正确方法是通过pip freeze > requirements.txt。希望这是你想要的。

相关问题