close

How to update/upgrade a package using pip?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to update/upgrade a package using pip in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to update/upgrade a package using pip?

  1. How to update/upgrade a package using pip?

    I'm not sure if it's exactly your problem, but in my case, I wasn't able to upgrade Django to 1.2.4 – I was always finishing with 1.2.3 version, so I uninstalled Django with:

  2. update/upgrade a package using pip

    I'm not sure if it's exactly your problem, but in my case, I wasn't able to upgrade Django to 1.2.4 – I was always finishing with 1.2.3 version, so I uninstalled Django with:

Method 1

I ran the following command and it upgraded from 1.2.3 to 1.4.0

pip install Django --upgrade

Shortcut for upgrade:

pip install Django -U

Note: if the package you are upgrading has any requirements this command will additionally upgrade all the requirements to the latest versions available. In recent versions of pip, you can prevent this behavior by specifying --upgrade-strategy only-if-needed. With that flag, dependencies will not be upgraded unless the installed versions of the dependent packages no longer satisfy the requirements of the upgraded package.

Method 2


I’m not sure if it’s exactly your problem, but in my case, I wasn’t able to upgrade Django to 1.2.4 – I was always finishing with 1.2.3 version, so I uninstalled Django with:

<virtualenv>/bin/pip uninstall Django

Then I removed <virtualenv>/build/Django directory and finally I installed the proper version with:

<virtualenv>/bin/pip install Django

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read