roschach
roschach

Reputation: 9336

Automatically update outdated pip3 packages with bash scripts

I have a bash script to automatically update pip3 packages:

It is one line script:

pip3 list --outdated | cut -d' ' -f1 | xargs pip3 install --upgrade

and it has always worked.

Now (maybe after the upgrade to Ubuntu 18.04) it is not working anymore apparently because of a wrong usage of pip3 install.

What is wrong with the script?

Upvotes: 1

Views: 77

Answers (1)

Amit Bhardwaj
Amit Bhardwaj

Reputation: 333

Looks like headers of the pip3 list are causing failure in installation of package. You can trim those header lines by using tail.

pip3 list --outdated | cut -d' '  -f1 | tail -n+3 | xargs pip3 install --upgrade

tail -n+3 removes the header and boundary line which only gives package names to xargs.

Upvotes: 2

Related Questions