This article has participated in the activity of “New person creation Ceremony”, and started the road of digging gold creation together

The first article in Python data Analysis

preface

As the saying goes, “To do a good job, you must sharpen your tools.” To run Python code, we need a Python environment. This article explains how to install and use Anaconda in detail.

The advantages of the Anaconda

Normally, we go directly to the Python website to install the environment, but why do I recommend using Anconda? First let’s look at what Anaconda is:

Anaconda is an integrated Python data science environment. In short, Anaconda has installed more than 180 third-party libraries for data analysis in addition to Python, and can install third-party libraries and create multiple environments using the conda command. Avoid the hassle of installing third-party libraries as opposed to just installing Python.

From the above description, we can simply say that Anaconda is a Python environment with many third-party libraries installed. It has two obvious advantages:

  • Convenient installation library
  • Easy to create and manage environments
The installation of the Anaconda

We here is installed in the Anaconda tsinghua mirror, url (mirrors.tuna.tsinghua.edu.cn/anaconda/ar…

Choose the version you install according to your computer system. Here I am Windows, 64-bit.

After downloading it to the local PC, run the installation. This is similar to most software installations, but there are two things worth noting:

Because the computer can have multiple users, we’re going to select all of them.

The first option is to add Anaconda to your computer’s environment variables, which doesn’t matter.

Anaconda use

In the Start menu, find the Anaconda Prompt. When you open it, you enter Anaconda’s environment.

Type Python and you can write Python code.

Creation of multiple environments: This is a reminder to beginners that you must exit the Python editing environment to run the following code.

Conda create --name XXX python=2 # XXX Conda create --name XXX python=3 conda create --name XXX python=3 Conda info --envs # activate activate XXX # deactivate XXX # exit conda remove --name XXX --all # delete an existing environmentCopy the code

Package installation and uninstallation:

Conda remove XXX # PIP install XXX PIP uninstall XXXCopy the code

Jupyter Notebook is an editor that allows you to write on stone, bamboo or paper. Python code can also be written to different editors.

If we want to put the code in drive D in a folder called Code, we need to go to drive D, and then go to this path on CD. Finally, type in Jupyter Notebook and a page will pop up to write Python code as shown.

D: CD D \ code Jupyter NotebookCopy the code