Anaconda use summary

Download and installation of Anaconda

Download the corresponding version from the official website. https://www.anaconda.com/download/

It can be installed directly under windows, under Linux:

bash Anaconda2-5.0.1-Linux-x86_64.sh
When installing, remember to check the Add environment variable (PATH), otherwise you need to configure it manually.

After the installation is complete, you can use conda --version and python --version to see if the installation is complete

Using Anaconda

add mirror

First add some domestic mirrors to speed up the download

# Add Anaconda's TUNA mirror
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

# Set the channel address to display when searching
conda config --set show_channel_urls yes
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/

All of the above images can be added.


Use of virtual environment

Conda can switch between different python versions by creating a virtual environment. In addition, creating a virtual environment can prevent conflicts between packages. You can open a topic to create an environment, and it will not cause interference.

#Create a python 2.7 version, an environment named test.
conda create --name test python=2.7

#After installation, you can activate it with activate
activate test #windows下
source activate test #Linux下

# exit the environment
deactivate #windows下
source deactivate #Linux下

#delete environment
conda remove --name test --all


conda management package

install package

# install a package
#Direct installation will search all channels
conda install numpy
#Install into the test environment
conda install -n test numpy
#Install via the specified channel
conda install -c Anaconda numpy
#Install the specified version through the specified channel
conda install -c Anaconda numpy=1.13.3
View installed packages

#View (current environment) installed packages
conda list
#View installed packages in the test environment
conda list -n test
find package

#find numpy
conda search numpy
#Find numpy in the channel conda-forge
conda search -c conda-forge numpy
Others

#update package
conda update -n test numpy
#delete package
conda remove -n test numpy
#update anaconda
conda update anaconda
#update python
conda update python
In addition, you can use conda xxx --help to view more command usage.







Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325631538&siteId=291194637