How can I use a pip requirements file to uninstall as well as install packages?

前端 未结 10 1188
猫巷女王i
猫巷女王i 2021-01-30 04:48

I have a pip requirements file that changes during development.

Can pip be made to uninstall packages that do not appear in the requirement

10条回答
  •  执笔经年
    2021-01-30 05:35

    You can now pass the -r requirements.txt argument to pip uninstall.

    pip uninstall -r requirements.txt -y
    

    At least as of pip 8.1.2, pip help uninstall shows:

    ...
    Uninstall Options:
      -r, --requirement     Uninstall all the packages listed in the given requirements file.  This option can be
                                  used multiple times.
    ...
    

提交回复
热议问题