How to add packages to Anaconda environment in Python
In this tutorial, we will see different ways to add packages to the Anaconda environment in Python. Anaconda is an open-source python distribution. It is widely used for the ease of package management and deployment. It has data-science packages for all major OS platforms. To manage packages, Anaconda provides “conda” as the package manager which is equivalent to “pip” in Python.
There are three ways in which we can add packages to the Anaconda environment.
Open the anaconda prompt. To install packages like TensorFlow, Keras, OpenCV and many more, use the following commands –
conda istall tensorflow
conda install keras
Conda install opencv
If you want to create a new environment, and install and activate TensorFlow there, use the command –
conda create -n tensorflow_env tensorflow
conda activate tensorflow_env
To install a specific version, use –
conda install tensorflow=2.0.0
Open the Anaconda Navigator. On the Anaconda Navigator home page, click on the “Environments” tab present on the left panel of the page.
The tab shows all the installed and uninstalled packages in our Anaconda. Search for the package you want to install and then click on Apply.
We can also install packages using the “pip” package manager. Open Anaconda prompt, install pip using the command –
conda install pip
Now you can install any package in anaconda environment using pip. Suppose we want to install OpenCV, follow the command –
pip install opencv-python
Now, at the end, to view all the installed packages, either use the Environments tab of Anaconda Navigator or type the following command in Anaconda prompt-
These were the different ways to add packages to Anaconda environment. Anaconda already has the most frequently used packages installed. So you will not need to add more in the beginning. But as you progress towards data science and machine learning, you will have to install more packages.
Want to add your thoughts? Need any further help? Leave a comment and I will get back to you ASAP 🙂