Install anaconda under Linux

1. Download (directly to Tsinghua mirror download)
download link: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ , select the appropriate version.
2. Install anaconda
bash Anaconda3-4.3.1-Linux-x86.sh
After the installation is complete, restart the terminal for anaconda to take effect.
During the installation process, you will be asked the installation path, just press Enter to default. There is a place asking you whether to add the anaconda installation path to the environment variable (.bashrc), enter yes, the default is no,

If you don't enter it, you need to configure the environment. According to the prompt, enter sudo gedit /etc/profile in the terminal to open the profile file. Add the statement export PATH=/home/xiaer/anaconda3/bin:$PATH, save and exit.
Restart the terminal, no, restart Linux,
after configuring the PATH, you can check whether it is correct through which conda or conda –version command.
Enter conda list to query, which libraries you have installed now, and the commonly used numpy and scipy are listed. If you have any packages that are not installed, you can run conda install * to install them.
If a package version is not up to date, run conda update *.

TUNA also provides an image of the Anaconda repository, run the following command:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

The Anaconda Python free repository can be added.

Run conda install numpy to test it.

The environment management function of creating a python environment
Conda allows us to install several different versions of Python at the same time and switch freely. For the above installation process, for example, we used the installation package corresponding to Python 2.7 above, then Python 2.7 is the default environment. If we need to install Python 3.6, we need to do the following:

conda create --name python36 python=3.6
source activate python36

You can see that there is python36 in the anaconda3/envs/ directory

Switch python environment
If you want to return to the default python 2.7 environment, run

deactivate python34 # for Windows 
source deactivate python34 # for Linux & Mac

Guess you like

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