The following command can be used to install a Python package in Anaconda:
pip install package_name
Steps to Install a Python Package in Anaconda
Step 1: Open the Anaconda Prompt
Locate your Anaconda Prompt. 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 following command:
pip install package_name
For example, let’s suppose that you’d like to install the pyautogui package, which can be used to control a mouse or a keyboard. In that case, type the following command in the Anaconda Prompt:
pip install pyautogui
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 installation is completed, 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 typed the command to uninstall the package, 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.