Check if my Python has all required packages

后端 未结 7 1879
悲&欢浪女
悲&欢浪女 2020-12-23 09:53

I have a requirements.txt file with a list of packages that are required for my virtual environment. Is it possible to find out whether all the packages mention

7条回答
  •  清酒与你
    2020-12-23 10:46

    You can use the -r option from pip freeze that verifies that. It generates a WARNING log for packages that are not installed. One appropriated verbose mode should be selected in order the WARNING message to be shown. For example:

    $ pip -vvv freeze -r requirements.txt | grep "not installed"
    
    WARNING: Requirement file [requirements.txt] contains six==1.15.0, but package 'six' is not installed
    

提交回复
热议问题