The author | | vlad source vlad (public number: fulade_me)

Anaconda

Anaconda is an open source tool with more than six million users. Anaconda is dedicated to providing the easiest way to use Python for data science computing and machine learning. Currently, Anaconda has more than 250 data science toolkits, and Conda toolkits are available for virtual environment management systems on Windows, MacOS and Linux platforms. Anaconda supports some of the most popular AI libraries, such as Sklearn, TensorFlow and Scipy.

Downloading the Installation package

Go directly to Anaconda’s website, find the Download address, click the Download button, and go to the Download section at the bottom of the page.

We can see that Anaconda offers two installation methods, one with a graphical interfaceGraphical InstallerThe other way is from the command lineCommand Line InstallerThe installation.

We choose64-Bit Graphical InstallerUse graphical interface to install, click download.

Installation Steps (Based on MacOS)

  1. Double-click the downloaded installation file (as shown below) to start the installation.

  1. Click on all the wayContinue to

And I’m going to selectContinue toCan.

  1. It’s in the MacStart the machineIt was just installedAnacondaAnd the name is:Anaconda-Navigator, click “Start”, and it will look like the following:

Configure command line tools

At this point, we have the Anaconda client installed, but in many cases we need to use the conda command at the command line tool

conda -version
Copy the code

My computer is configured with ZSH, so it will display ZSH:

zsh: command not found: conda
Copy the code

Obviously we can’t use conda yet.

1. ZSH configuration process

ZSHRC file, usually in /Users/{username}/.zshrc, where {username} is your current Mac username. Open the. ZSHRC file in Notepad (you can also edit it using the vim command) and add the following line to the last line of the file:

export PATH="/opt/anaconda3/bin:$PATH"
Copy the code

Then save the command line tool and go to /Users/{username} and run

source .zshrc
Copy the code

Then perform

conda --version
Copy the code

You can see the output version number:

Conda 4.9.2Copy the code
2. The following configuration

Bash_profile file, usually in /Users/{username}/.bash_profile, where {username} is your current Mac username. Open the.bash_profile file with Notepad (you can also use vim to edit it) and add the following to the last line of the file:

export PATH="/opt/anaconda3/bin:$PATH"
Copy the code

Then save the command line tool and go to /Users/{username} and run

source .bash_profile
Copy the code

Then perform

conda --version
Copy the code

You can see the output version number:

Conda 4.9.2Copy the code

Adding Common Sources

Due to network problems, sometimes it is slow to download directly from foreign libraries. We can configure a domestic mirror source for Conda. Add a domestic mirror source command as follows:

  1. Tsinghua source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
Set the channel address to display when searching
conda config --set show_channel_urls yes
Copy the code
  1. Add cas source
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
Set the channel address to display when searching
conda config --set show_channel_urls yes
Copy the code

To check whether the add is successful, you can use the command

conda config --show
Copy the code

Show the added source in the Channels field

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
Copy the code

Conda Common command

upgrade

conda update conda  # update conda
conda update anaconda # update anaconda
conda update anaconda-navigator    #update the latest version of Anaconda-navigator
conda update python Update # python
Copy the code

Management environment

conda env list  Display all virtual environmentsConda create --name fulade python=3.7Create an environment called Fulade and specify Python version 3.7
activate fulade  # Activate the environment named Fulade (for Windows)
source activate fulade  Activate the environment named Fulade (for Linux & Mac)
deactivate fulade   # Close the environment named Fulade (for Windows)
source deactivate fulade  # Turn off the environment named Fulade (for Linux & Mac)
conda remove --name fulade --all # Delete an environment named Fulade
conda create --name newname --clone oldname # clone oldname to newname
Copy the code

Package management

conda list  View the installed package in the current environment
conda search numpy Numpy = numpy
conda install numpy  Use -n to specify the environment --channel to specify the source address
conda install -n fulade numpy  Install the package named fulade in fulade's environmentConda install - channel tensorflow = 1.8.0 comes with https://conda.anaconda.org/anaconda# use the address https://conda.anaconda.org/anaconda to install tensorflow
conda update numpy   # Update numpy package
conda uninstall numpy   # uninstall numpy package
Copy the code

Clean up the conda

Conda clean -p // Delete unnecessary packages conda clean -t // Delete tar packages conda clean -y --all // Delete all installation packages and cacheCopy the code