Skip to content
Advertisement

pip install & uninstall recursively in non-interactive mode

As a part of my bash script, I want to install and uninstall pip dependencies that I have their names in a file in a non-interactive mode. I was able to search around and find these commands:

pip3 uninstall --yes -r host-requirements.txt
pip3 install --no-input -r host-requirements.txt

I wasn’t able to find --yes & --no-input options in the help doc of pip, and I’m not sure if they are officially supported.

Advertisement

Answer

For uninstall, you can use the --yes or -y flag as described here: https://pip.pypa.io/en/stable/cli/pip_uninstall/

For installation, you can pass a yes | pip install -r requirements.txt as described here: python pip silent install

Hope this helps.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement