Anaconda Practical Guide

This article was first published on the blogger's public account LISTONE, welcome to pay attention!
Blogger public account

Anaconda Introduction

Anaconda can easily obtain the package and manage the package, and at the same time can manage the release version of the environment. Anaconda contains more than 180 scientific packages and their dependencies including conda and Python.

Anaconda advantages

  1. Quickly install, run, and upgrade packages and their dependencies.
  2. Create, save, load and switch environments easily on your computer.

If the package you need requires a different version of Python, you do not need to switch to a different environment because conda is also an environment manager. With just a few commands, you can create a completely independent environment to run different Python versions, while continuing to use your usual Python version in your regular environment.

  1. conda combines the functions of pip and virtualenv.

Anaconda installation

  1. Anaconda can be installed and used on multiple platforms

    • Windows

    • macOS

    • Linux

  2. Installation conditions

    • System: 32-bit or 64-bit
    • Download file size: about 500MB
    • Installation requires space: about 3GB
  3. installation steps

    Graphical installation, relatively simple

Manage conda

Verify successful installation

Windows can open powershell, Linux or macOS can open Terminal for operation. Enter the following command, it will display the current conda version number.

conda --version

Update conda

You can execute the following command to update conda. When prompted, enter y to confirm.

conda update conda

View conda help information

conda --help

or

conda -h

Virtual environment management

Now it is the top priority. The main purpose of installing Anaconda is to manage the environment of various python versions of my system.

Create an environment

conda create --name <env_name> <package_names>
  • Command interpretation
    • <env_name> Name of the environment created, generally named in English
    • <package_names> Namely the package name installed in the environment, of course, it can also be installed later, this place can be empty.

Activation environment

Linux or macOS

source activate <env_name>

Windows

activate <env_name>

When the environment is activated, we will see that our command prompt will start with the name of our virtual environment, then we can manage the current environment.

Exit the environment

Linux or macOS

source deactivate

Windows

deactivate

Show created environment

conda info --envs

envs

The asterisk in the result indicates the current environment, the default bit is base

Delete the environment

conda remove --name <env_name> --all

Management Pack

Installation package

conda install --name <env_name> <package_name>
或者
conda install <package_name>
或者
pip install <package_name>

Uninstall package

conda remove <package_name>

Update package

conda update --all
或者
conda upgrade --all

Anaconda and jupyter notebook linkage

First create a virtual environment:

conda  create -n nlp python=3.7

View the created virtual environment:

conda info -e
或者:conda env list

Then enter the virtual environment:

activate nlp

Install ipykernel using pip in a virtual environment

pip install ipykernel

Then execute

python -m ipykernel install --name nlp
Published 3 original articles · Likes0 · Visits 4

Guess you like

Origin blog.csdn.net/cookieXSS/article/details/105475603