Check the conda version Upgrade the conda environment management of the current version List all the environments. Install a new Python environment of a different version. Copy an environment. Anaconda supports import and export to facilitate migration of imported environment information, that is, to create a new environment based on the configuration file: Remove the environment Activate the environment, use Disable an active environment, Use Package Management View installed packages Install packages to the specified environment Install a package from Anaconda.org install packages by using the PIP command Conda Configuration Add the image source View the current image source Delete the image source Set display the source URL during installation, View the conda configuration file. Other precautions The base that appears before the command line after conda is installed. Cancel the base environment that automatically activates Conda every time you start
Anaconda is introduced
Anaconda refers to an open source distribution of Python that contains more than 180 science packages and their dependencies, including Conda, Python, and others. Because of the large number of science packages included, Anaconda has a larger download file, and the smaller distribution (conda and Python only) of Miniconda can also be used if you only need certain packages or if you need to save bandwidth or storage space.
Anaconda is cross-platform, available for Windows, MacOS, and Linux.
CentOS 7 Install Anaconda3
-
Run the following command to fetch the script locally (the file name may vary depending on the version) :
wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
Copy the code -
Run bash anaconda3-5.3.1-linux-x86_64. sh to install Anaconda
-
ENTER the installation program, prompting “ENTER” to continue:
Please, press ENTER to continue
>>> ENTER
Copy the code -
Type Yes to confirm acceptance of the license agreement
Do you accept the license terms? [yes|no]
[no] > > >yes
Copy the code -
Confirm the installation position of Anaconda and change it with or without change
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>> /opt/anaconda3
Copy the codeThe installation location can be specified during the installation script execution. For example, to specify the installation location to the /opt/anaconda3 directory, you can modify the execution content as follows: Bash bash anaconda3-5.3.1-linux-x86_64. sh -p /opt/ Anaconda3
-
After the installation is complete, a message appears asking whether to initialize Anaconda3 in the user’s.bashrc file.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] > > >yes
Copy the code -
Bashrc: source ~/.bashrc
Supplement:
Add the contents of the installation script to the. Bashrc file to /etc/bashrc. It looks something like this, and then you execute source /etc/bashrc
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
#!!!!! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
Copy the code
This section describes how to use the conda command
Help directory
conda create -h
Check the Conda version
conda --version
Upgrade the current version of Conda
conda update conda
Environmental management
List all the environments
conda info -e
conda env list
Install a new python environment with a different version
Conda create --name py27 python=2.7
Copy an environment
To replicate an environment by cloning. Here we will clone Snowfllakes to create a replica called Flowers. conda create -n flowers –clone snowflakes
Create a new environment
conda create --name busind
Export environment, Anaconda supports import and export to facilitate migration
conda env export > environment.yaml
Import environment information, that is, create a new environment based on the configuration file:
conda env create -f environment.yaml
Remove the environment
conda remove -n py274 --all
Activate to enter the environment, use
conda activate newname
Deactivate an active environment, please use
conda deactivate
Package management
View the installed package
conda list
Installs packages to the specified environment
conda install --name newName beautifulsoup4
Install a package from Anaconda.org
Conda install--channel https://conda.anaconda. ort/pandas
Install packages through the PIP command
conda activate bunnies
pip install see
Copy the code
Conda configuration
Adding a Mirror Source
conda config --add channels https://pypi.tuna.tsinghua.edu.cn/simple
View the current mirror source
conda config --show-sources
Deleting a Mirror Source
conda config --remove channels https://pypi.tuna.tsinghua.edu.cn/simple
Set installation to display the source URL (no)
conda config --set show_channel_urls yes
View all Settings of the source, including the link, show_channel_urls value:
conda config --show
View the Conda configuration file
cat ~/.condarc
Other Matters needing attention
After conda is installed, delete the base environment that automatically activates Conda each time it is started
-
Methods a
- Run the conda deactivate command to exit the base environment and return to the automatic environment
conda deactivate
-
Method 2
- This is done by setting the auto_activate_base parameter to false:
conda config --set auto_activate_base false
- Use the following statement to restore base if you want to keep it
conda config --set auto_activate_base true
- This is done by setting the auto_activate_base parameter to false:
Pay attention and don’t get lost
The article continues to update every week, you can wechat search “ten minutes to learn programming” the first time to read and urge more, if this article is written well, feel something ~ for praise 👍 for attention ❤️ for share ❤️ everyone’s support and recognition, is the biggest power of my creation, we see the next article!