Monday, May 23, 2022
0 comments

Python- How to Install a Package in Python using PIP

11:43 AM

Steps to Install a Package in Python using PIP

(1) First, type Command Prompt in the Windows search box

(2) Next, open the Command Prompt, and you’ll see the following screen with your user name (to avoid any permission issues, you may consider to run the Command Prompt as an administrator):

C:\Users\Ron>

(3) In the Command Prompt, type “cd\” as this command will ensure that your starting point has only the drive name:

C:\Users\Ron>cd\

(4) Press Enter. Now you’ll see the drive name of C:\>

C:\>

(5) Locate your Python Scripts path. The Scripts folder can be found within the Python application folder, where you originally installed Python.

Here is an example of a Python Scripts path:

C:\Users\Ron\AppData\Local\Programs\Python\Python39\Scripts

(6) In the Command Prompt, type cd followed by your Python Scripts path:

C:\>cd C:\Users\Ron\AppData\Local\Programs\Python\Python39\Scripts

(7) Press Enter, and you’ll see something similar to the following:

C:\Users\Ron\AppData\Local\Programs\Python\Python39\Scripts>

(8) Now, type the pip install command to install your Python package. The pip install command has the following structure:

pip install package_name

Since in our case, we would like to install the pandas package, then type the following command in the Command Prompt:

pip install pandas 

C:\Users\Ron\AppData\Local\Programs\Python\Python39\Scripts>pip install pandas

(9) Finally, press Enter, and you’ll notice that the package (here it’s pandas) will be installed:

Successfully installed pandas-1.2.4

You can quickly check if the package was successfully installed in Python, by opening the Python IDLE and then running the command “import pandas”

If no errors appear, then the package was successfully installed.


Uninstall a Package using PIP

pip uninstall package_name

0 comments:

 
Toggle Footer