Anaconda is an open-source Python distribution that supports Linux, MAC, and Windows. It contains more than 180 science packages and their dependencies, such as Python core, Conda, Numpy, Pandas, and Matplotlib. This will stop you from fail installing a library because of the lack of dependencies. Because it contains a large number of science packages, Anaconda’s download file is also large (several hundred MB). If you only need some of them, or need to save bandwidth or storage space, you can also use miniconda, a smaller distribution (only including condo and python).
1. Anaconda Component Introduction.
Once anaconda is installed, it will provide us the following executable programs.
1.1 Anaconda Navigator.
A general control dashboard to configure all aspects of Anaconda. It contains several useful applications.
1.2 Anaconda Prompt.
Command line console, easy to execute some commands in anaconda environment.
1.3 Jupyter Notebook
A powerful interactive web-based environment.
An integrated environment ide similar to pycham.
Like the pip package management tool of python, Anaconda also comes with a package management tool which is named conda, it has its own package repository and server. Conda is a dedicated open source package and environment management tool for Anaconda. It provide below functions.
1.5.1 Environment Management.
- Create a new environment : conda create -n env_name list of packages.
# Create a new environment, the environment name is py3, contains python 3.7, pandas package. conda create -n py3 python=3.7 pandas # Clone an exist environment. conda create --name new_env --clone old_env
- Enter the environment by name.
# Linux, Mac source activate env_name # Windows activate env_name
- Exit the environment.
# Linux, Mac source deactivate # Windows deactivate
- Remove environment.
conda env remove -n env_name
- List all conda environment.
conda env list
- View environment information.
conda info --envs
- Save current environment package information into a yaml file.
conda env export --name env_name > environment.yaml
- Load conda environment from a yaml file.
conda env create -f environment.yaml
1.5.2 Packages Management.
You can use conda to install, update, and uninstall packages, and it focuses more on data science related packages. Conda does not only manage Python packages, it can also install none Python packages. For example, in the new version of anaconda, R-language integrated development environment Rstudio can be installed. Below is some common usage of conda.
- Confirm conda is installed.
- Update conda version.
conda update conda
- Query conda information.
- Upgrade anaconda.
conda update anaconda
- Install package.
conda install package_name
- Install multiple packages at the same time.
conda install pkg_1 pkg_2 pkg3 ... ( ie: conda install numpy scipy pandas
- Install the specified version.
conda install numpy=1.10
- Remove package.
conda remove package_name
- Update package.
conda update package_name
- Update all packages.
conda update --all
- List all installed packages.
- Query a package, or fuzzy query.
conda search search_key_word