To upgrade a package using pip, you can use the pip install command with the --upgrade or -U option. For example, to upgrade the requests package:
pip install --upgrade requests
You can also upgrade all packages to their latest version by using the following command:
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
This command first lists all the installed packages using the pip freeze command, then filters the list to exclude -e (editable) packages, and finally upgrades each package using the pip install -U command.