2016-05-26 127 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。希望這是你想要的。

相關問題