Search code examples
pythonpycharmanacondapygal

How to add a package to a new Anaconda environment?


I have installed the pygal package through the following command line:

conda install -c akode pygal

However, when I search this package in the Anaconda, I can only find this package in the base (root) environment. When I try to search this pygal package in my newly created environment, nothing can I find.

Why does this happen? and is there any solution to this problem?

enter image description here enter image description here


Solution

  • When you are not in an environment and run conda install , it will install it in the base. If you activate your environment then install the package using conda install, it will apply to your environment.

    source activate data_visualization_coursera
    conda install -c akode pygal
    

    Or you can install a specific package to an environment using this command

    conda install -n <environment_name> <package_name>
    

    You can find all of the documentation here https://conda.io/docs/user-guide/tasks/manage-environments.html