python

How to Install Pip for Python on Windows

Pip is one of the best tools for installing and managing Python packages. Pip has gained its reputation by the number of applications using this tool. Used for its ability to manage binary packages, Pip allows you to install third-party packages. Although the latest versions of Python come with pip installed by default, this tutorial will show how to install pip for Python on Windows, check its version, and show some basic commands for its use.
 

 

Prerequisites:

Before you install Pip on your Windows, you must confirm that Python is installed.

The easiest way to test the installation of Python on your Windows is to open the command prompt (click on the Windows icon and type cmd, then click on the command prompt icon).
 


Once the Command Prompt window opens, type python and press Enter.
 

If Python is installed correctly, you should see the following output:

Python 3.5.2 (v3.5.2:8bf2aa5043, Jun 22 2020, 09:12:59) [MSC v.1900 64 bit (AMD64)] on win32
 Type "help", "copyright", "credits" or "license" for more information.

If you get a message like:

'python' is not recognized as an internal or external command, executable program, or batch file.

Python is not installed or the path variable has not been set. You will either need to launch Python from the folder where it is installed or adjust the path variable to allow Python to be launched from any location. For more information on installing and using Python, see our tutorial on How to install python on Windows.
 

 

Pip installation

Once you have confirmed that Python is correctly installed, you can proceed with the installation of Pip.

  • Download get-pip.py in a folder on your computer.
  • Open the command prompt and navigate to the folder containing the get-pip.py installer.
  • Run the following command: python get-pip.py

Pip is now installed!

We can verify that Pip was installed correctly by opening the command prompt and typing the following command:

pip -V

You should see an output similar to the following:

pip 18.0 from c:\pc\users\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.5)

Now that Pip is installed and configured, you can start using it to manage your Python packages. For a brief overview of the commands and syntax available for Pip, open the command prompt and type:

pip help

 

How to download a package with PIP

Downloading a package is very easy.

Open the command prompt and tell PIP to download the desired package.

Example: Access the command prompt and type the following command, to download the “camelcase” package:

> pip install camelcase

You have now downloaded and installed your first package!
 

 

How to use the installed package

Once the package is installed, it is ready to use.

Example: Import the “camelcase” package into your project.

import camelcase

camel = camelcase.CamelCase()

str = "welcome to stackhowto!"

print(camel.hump(str))

Output:

Welcome To Stackhowto!

 

Find packages

Find more packages on https://pypi.org/.
 

Remove a package

Use the uninstall command to remove a package. The following example removes the “camelcase” package:

> pip uninstall camelcase

 

Display installed packages

Use the list command to list all the packages installed on your system:

> pip list

Output:

Package         Version
-----------------------
absl-py         0.7.0
camelcase       0.2
mysql-connector 2.1.6
numpy           1.11.0
pandas          0.18.0
pip             18.1
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *