How to Install Python Package in Anaconda

The following command can be used to install a Python package in Anaconda:

pip install package_name

In the next section, you’ll see the complete steps to install a package in Anaconda. You’ll also observe how to uninstall a package.

Steps to Install a Python Package in Anaconda

Step-1: Open the Anaconda Prompt

Locate your Anaconda Prompt, and then open it.

For example, if you’re using Windows, you can simply type ‘Anaconda Prompt’ in the Windows Search Bar (and then click on it).

You’ll then see the following screen with your user name:

(base) C:\Users\Ron>

Step-2: Install the Package

To install a Python package in Anaconda, simply use the command that was introduced at the beginning of this guide:

pip install package_name

For example, let’s suppose that you’d like to install the pyautogui package, which can be used to control the mouse and keyboard. In that case, type the following command in the Anaconda Prompt:

pip install pyautogui

After you typed the above command, press ENTER to proceed with the installation:

(base) C:\Users\Ron>pip install pyautogui

The Python package would now get installed.

Step-3: Verify that the package was installed

Once the package got successfully installed, you’ll see the following status in the Anaconda Prompt:

Installing collected packages: pyautogui
Successfully installed pyautogui

Next, you’ll see how to uninstall an existing package.

Steps to Uninstall a Python package in Anaconda

Step-1: Open the Anaconda Prompt

First open the Anaconda Prompt. As before, you’ll see the following screen with your user name:

(base) C:\Users\Ron>

Step-2: Uninstall the Package

You can then uninstall a Python package using this template:

pip uninstall package_name

Once you are done typing the command with the package name that you’d like to uninstall, press ENTER to execute the command.

To proceed with the removal of the package, type ‘y‘ and then press ENTER:

Proceed (y/n)? y

You may also want to check the following guide for the steps to upgrade PIP in Anaconda.