News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

no datas

Anaconda and Jupyter Notebook entry-level detailed tutorial

posted on 2023-05-21 17:44     read(1057)     comment(0)     like(6)     collect(2)


Anaconda

Introduction

We use the Anaconda distribution as the Python environment. Anaconda refers to an open source Python distribution that includes more than 180 scientific packages such as conda and Python and their dependencies.

Note: anaconda installs python, no additional python is required

Anaconda supports Linux, Mac, Windows, and includes many popular Python packages for scientific computing and data analysis . Anaconda and Jupyter notebooks have become the standard environments for data analysis.

download

Official website download
https://www.anaconda.com/

Tsinghua Mirror
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

Install

I won't talk about the specific installation details, you can refer to the following tutorials:

(To be added)

use

First of all, you can open the command line Anaconda Prompt ( anaconda3 ) that comes with Anaconda. The feature is that you can enter the basic environment of the anaconda command line.

image-20220716175817925

Check python version

In addition, anaconda also has ipython, an enhanced python interpreter.

change source

TUNA also provides a mirror of the Anaconda repository, run the following command

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

You can switch to Tsinghua source, and the access speed is very fast

You can also find the configuration file of anaconda in the user folder. The common path is: C:\Users\yourname Edit the .condarc file inside and delete the default.

conda management tool

After installing Anaconda, we installed conda, a package management tool, including more than 180 scientific packages and their dependencies such as Python, Jupyter NoteBook , Numpy, Pandas, Matplotlib.Sklearn, etc.

conda package manager command

which conda or conda -version command to check whether the installation is correct

conda list query

conda install* install

conda update* upgrade

conda remove* uninstall

Note: conda is very powerful and can install non-python dependent libraries. And pip can only install python related libraries.

Use conda to create a new python environment:

create create -n myenv python=3

Enter the environment source activate myenv

Leave the environment source deactivate

List the environment conda env list

Remove the environment conda env remove -n env_name

In addition to installing anaconda directly, you can also use the following two methods

install miniconda

If you don't want so many packages directly, you can also download miniconda

https://conda.io/miniconda.html

Install miniconda (just provides a conda package management tool), then conda installs the packages you need

$ conda install numpy

install using pip

Here we use Douban source installation, which is very fast

pip install numpy pandas matplotlib sklearn -i https://pypi.doubanio.com/simple

Parameter -i indicates the source

继续安装Jupyer notebook
pip install notebook

Jupyter Notebook

简介

其中针对Jupyter Notebook官方描述如下:

The Jupyter Notebook is a web-based interactive computing platform. The notebook combines live code, equations, narrative text, visualizations, interactive dashboards and other media.

Jupyter Notebook 是一个基于 Web 的交互式计算平台。 该笔记本结合了实时代码、方程式、叙述性文本、可视化、交互式仪表板和其他媒体。

简单讲,Jupyter Notebook(此前被称为IPython notebook)是一个基于网页的交互式笔记本,支持运行多种编程语言。本质是一个Web应用程序,便于创建和共享文学化程序文档, 支持实时代码,数学方程,可视化和markdown。用途包括: 数据清理和转换, 数值模拟,统计建模,机器学习等等。

使用

打开jupyter notebook:在命令行模式下输入 jupyter notebook 回车即可在浏览器中打开jupyter notebook,而同时当前的cmd目录就是打开jupyter后显示的目录

如果想新建一个notebook,只需要点击New,选择你希望启动的notebook类型即可,比如python.

使用常识:

  • shift+enter执行

    没执行的都没有行号,执行过的In [num]会有行号,而*则代表正在执行。

一、工具栏详解:

image-20220716223327690

从左至右依次:保存 添加行 删除行 复制 粘贴 将该行上移 下移 运行 中断 重启kernel 重启并执行全部代码

这里注意:重启kernel后虽然显示行号,但是之前代码并未执行!

二、菜单栏详解:

1.File

image-20220716224344185

In File, you can focus on Download as, which can download files in many formats. The rest can understand the function literally.

2.Edit

The specific functions are shown in the figure below, and shortcut keys are often used instead.

image-20220716225129601
to be continued

My blog will soon be synchronized to the Tencent Cloud developer community, and everyone is invited to join: https://cloud.tencent.com/developer/support-plan?invite_code=27jhez1744iso



Category of website: technical article > Blog

Author:Believesinkinto

link:http://www.pythonblackhole.com/blog/article/25293/92b8a69ec3c13f5b507d/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

6 0
collect article
collected

Comment content: (supports up to 255 characters)