One, in theubuntuAn initialization error is displayed when the Anaconda installation is complete

1-1 phenomenon:

Sudo su anaconda3-2021.11-linux-x86_64. sh can be used to install Anaconda in Ubuntu, but the following error is reported during initialization:

Anaconda3-2021.11-linux-x86_64. sh: 516: Syntax error: “(” unexpected (Expecting “)”)

1-2 Causes of the problem:

(1) The current user does not have the permission of the root user to execute the initialization script.

I understand that although SOdu was used to execute the installation script at the beginning, several commands were executed during the script process, and the execution of the wrong statements was no longer authorized.

The difference between su and sudo is as follows: Su is directly used as an administrator to perform subsequent operations. Sudo is the temporary root power for the average user.

(2) Compatibility issues, because Linux default root to Dash instead of bash execution error.

1-3 Solutions:

Step 1: Authorize users

French method 1: Run the su command to switch to user root

(1) : change the password of us, run the sudo passwd root command (press Enter to set the new password, skip this step if you have set the root password before)

(2) switch to user root and run su (Enter the password set in Step 1).

Method 2: Directly add the current user to the super user group

Run the sudo adduser XXXX (user name) sudo command

For details about user permissions, see: Adding Ubuntu users and setting super Administrator permissions – Single Blast – Blog Garden

Step 2: Resolve root compatibility issues

Reference [Linux error: Syntax error: “(” unexpected solution _u012572552 blog – CSDN] (blog.csdn.net/u012572552/… Method in “Linux is reporting an error: Syntax error: “(” unexpected solution _u012572552’s blog-csdn blog “) In root, run the following command:

## # to choose NO
dpkg-reconfigure dash
Copy the code

1-4 Run the installation program again

Run the us command to switch to user root and run the sh anaconda3-xxxxxx command (modified according to the downloaded version) -linux-x86_64. sh -u command to reinstall the software. Note that since this is the second installation, you need to cover the files from the previous installation directory, so you need to add the -u parameter

After yes, the execution is successful and the download of PyCharm is provided. Run the conad list command to check whether the installation is successful. The installation list can be displayed normally.

2. General user executioncondaReport “command not found” :

2-1

After the installation is successful, the root user can run the conda command without exception. Other users can report that the conda command cannot be found and cannot be used normally.

Even if you run the CD command to switch to the installation directory and run the conda command, an error message “command not found” is still displayed.

2-2 Cause of the problem

Considering that the current user has been added to the administrator group, it should not be a permission problem; In addition, the command cannot be found in the installation directory, most likely due to the setting of the environment variable PATH.

2-3 solutions

Add anaconda’s directory to the PATH variable.

After reading the explanation of the three ways to change the PATH in Ubuntu _ a bowl of rice noodles -CSDN blog _Ubuntu To change the PATH, I decided to change the.bashrc file in the user’s home directory.

Open gedit editor with sudo gedit /home/xxxxx (username) /.bashrc

Add PATH=”$PATH:/home/XXXXX (user name) /anaconda3/bin” to the last line of the text, and pay attention to the case of PATH.

2-4 Execution effect

(1) Command: Open a terminal again and run conda info -e to display the result normally. Note that the modified.bashrc file must be redeveloped to see the effect.

(2) Start the graph line interface: Execute Anaconda-Navigator in the terminal

For ease of use, you can set up application shortcuts. The steps are as follows:

Go to the /usr/share/applications directory on the terminal: CD /usr/share/applications

Switch to user root: us (Press Enter, enter root password)

Start gedit: gedit

As shown in the figure below

Add the following information to gedit and change it to the actual installation path of Anaconda.

Comment=Scientific Python Development Environment - Python3 Exec=bash -c "/**** /anaconda3/bin/anaconda-navigator" Icon=/**** Consistent with just add environment variable)/best anaconda3 / lib/python3.9 / site - packages/anaconda_navigator/static/images/anaconda. The PNGCopy the code

As shown in the following figure, the file name anaconda. desktop is saved in the /usr/share/applications directory.

The icon is displayed in the application

As shown in the figure below

Appendix: Add Anaconda’s domestic data source command for backup

Go directly to the terminal and press Enter. Note that the more data sources the better.

Tsinghua university:

Conda config --show channels #  conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --set show_channel_urls yes conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/Copy the code

Beijing:

conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ this I've never used, but it looks like R channel, You can add a try. Conda config - add channels at https://mirrors.bfsu.edu.cn/anaconda/pkgs/r/Copy the code

Official:

conda config --add channels bioconda

conda config --add channels conda-forge
Copy the code

Data source information from Conda installation and Use (update 2021-04-27) – Jan

This article uses the article synchronization assistant to synchronize