codingstreets
Search
Close this search box.
python-pip

Quick Introduction to Python PIP

In This Article You Will Learn About Python PIP

Python PIP – Before moving ahead let’s know a little bit about Python JSON

Python PIP – Python Package Installer (PIP) in Python is bundles of package.

Note: PIP already comes pre-installed with Python version 3.0xx or later.

Package – It is Python short or long code, stored in a file.

Check if PIP is Installed

Example – Check PIP version.

Navigate your command line in Terminal Section of your text editor. And Type following code:

For Windows

"pip --version" or “pip -V”

For Mac/OS

python3 -m pip --version

If pip is already installed, it will show the current version of PIP installed otherwise it will show an error.

Alternatively – Another way to view this

Example – Check if PIP is Installed, by installing a package.

Syntax - <pip install package name>

To install a particular package, navigate your command line in Terminal Section of your text editor. And Type following code:

"pip install urllib3"

If pip is already installed, it will install the package successfully, otherwise, it will show an error saying ‘PIP is not installed’.

In the meantime, if PIP is installed, it will show PIP with its latest version. Otherwise, it will shown an error.

Install PIP

If PIP is not installed in Python, then head-over to official website of Python PIP to install PIP in Python.

To install pip, navigate your command line in Terminal Section of your text editor. And Type following code:

“pip install pip”

Or visit:

https://pypi.org/project/pip/

Upgrade PIP version

To begin with upgrading PIP version

Navigate your command line in Terminal Section of your text editor. And Type following code:

“pip install --upgrade pip”

It will upgrade the PIP to the latest version of PIP.

Find Packages

Visit – https://pypi.org/project/pip/

To find Packages for Python.

Download or install Package

Example – Install a package named “urllib3”.

Syntax - <pip install package name>

To install a particular package, navigate your command line in Terminal Section of your text editor. And Type following code:

"pip install urllib3"

It will show package installed successfully with its current latest version.

Congratulations!!! You’ve installed your first Python PIP package.

Install Specific Version of Package

Example – Installed a specific version of PIP package.

Syntax - <pip install package name==version>

To install specific version of PIP package, Navigate your command line in Terminal Section of your text editor. And Type following code:

"pip install urllib3==1.2"

It will install the specific version of PIP package.

Upgrade already installed package

Example – Upgrading already Installed package.

Syntax - <pip install --upgrade Package name>

To upgrade already installed PIP package, Navigate your command line in Terminal Section of your text editor. And Type following code:

"pip install --upgrade urllib3"

Use installed package

To use installed package, use ‘import’ keyword.

Syntax - <import package name>

Navigate your command line in Terminal Section of your text editor. And Type following code:

"import urllib3"

Now proceed ahead and do operation on PIP package –

Example – Sending an HTTP request.

import urllib3

URL = urllib3.PoolManager()
Req = URL.request('GET', 'http://www.codingstreets.com')

print(Req.status) 
python-pip

As you can see it sent an HTTP request.

Remove Package

To remove or delete a package from Python, use ‘uninstall’ keyword.

Syntax - <pip uninstall package name>

Navigate your command line in Terminal Section of your text editor. And Type following code:

“pip uninstall urllib3”

List of Package

To see the list of packages of PIP, use ‘list’ keyword.

Syntax - <pip list>

Navigate your command line in Terminal Section of your text editor. And Type following code:

“pip list”
python-pip

As a result it will return a list of packages with the version installed in Python. 

If you find anything incorrect in the above-discussed topic and have any further questions, please comment down below.

Like us on

Recent Post

Popular Post

Top Articles

Archives
Categories

Share on