Get a list of all the outdated packages
$ pip list --outdatedOpen a command shell by typing ‘powershell’ in the Search Box of the Task bar 
Update All Python Packages On Windows
$ pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}Update All Python Packages On Linux
$ pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U Pip can be used to upgrade all packages on either Windows or Linux:
- Output a list of installed packages into a requirements file (requirements.txt):
$ pip freeze > requirements.txt- 
Edit requirements.txt, and replace all ‘==’ with ‘>=’. Use the ‘Replace All’ command in the editor. 
- 
Upgrade all outdated packages: 
$ pip install -r requirements.txt --upgradeUpdating All Packages In A Pipenv Environment
The simplest way to update all the unpinned packages in a specific virtual environment created with pipenv is to do the following steps:
Activate the Pipenv shell that contains the packages to be upgraded
$ pipenv shellUpgrade all packages
$ pipenv updateIf a requirements.txt file is not available, you can use the pip show command to output all the requirements of a specified package:
$ pip show <packagename>Automatically create requirements.txt
You can use the following code to generate a requirements.txt file:
$ pip install pipreqs
$ pipreqs /path/to/projectMore info related to pipreqs can be found here. Sometimes you come across pip freeze, but this saves all packages in the environment including those that you don't use in your current project.
NOTE
As packages age, many of them are likely to have vulnerabilities and bugs logged against them. In order to maintain the security and performance of your application, you’ll need to update these packages to a newer version that fixes the issue.
The pip package manager can be used to update one or more packages system-wide.
However, if your deployment is located in a virtual environment, you should use the Pipenv package manager to update all Python packages.