DEV Community

Nilotpal Choudhury
Nilotpal Choudhury

Posted on

Answer: How to upgrade all Python packages with pip

You can use the following Python code. Unlike pip freeze, this will not print warnings and FIXME errors For pip < 10.0.1

import pip from subprocess import call packages = [dist.project_name for dist in pip.get_installed_distributions()] call("pip install --upgrade " + ' '.join(packages), shell=True) 

For pip >= 10.0.1

import pkg_resources

Top comments (0)