Browse Source

Update Python, Jupyter, Install description

pull/5/head
bushuhui 3 years ago
parent
commit
bfc77bbde6
8 changed files with 87 additions and 223 deletions
  1. +36
    -205
      0_python/0-ipython_notebook.ipynb
  2. +5
    -5
      0_python/1_Basics.ipynb
  3. +18
    -4
      0_python/2_Print_Statement.ipynb
  4. +2
    -2
      0_python/3_Data_Structure_1.ipynb
  5. +5
    -2
      0_python/README.md
  6. BIN
      0_python/images/jupyter_shortcuts.png
  7. +1
    -1
      README.md
  8. +20
    -4
      references_tips/InstallPython.md

+ 36
- 205
0_python/0-ipython_notebook.ipynb
File diff suppressed because it is too large
View File


+ 5
- 5
0_python/1_Basics.ipynb View File

@@ -129,7 +129,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"用于表示某物或值的名称称为变量。在python中,可以声明变量并为其赋值,如下所示:"
"用于表示某物或值的名称称为**变量**。在Python中,可以声明变量并为其赋值,如下所示:"
]
},
{
@@ -310,7 +310,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Python3版本之后,自动整数的除法转换成浮点数,这样和人类的直觉比较一致。"
"Python3版本之后,自动整数的除法转换成浮点数,这样和人类的直觉比较一致。"
]
},
{
@@ -839,7 +839,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**divmod(x,y)** 输出商和余数在元组(你将在后面的章节学习)的格式(商,余数)。"
"**divmod(x,y)** 输出商和余数在元组的格式(商,余数)。"
]
},
{
@@ -920,7 +920,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**range( )** 函数输出指定范围的整数。它还可以用于通过指定特定范围内的两个数字之间的差来生成一个序列。元素以列表的形式返回(稍后将详细讨论)。"
"**range( )** 函数输出指定范围的整数。它还可以用于通过指定特定范围内的两个数字之间的差来生成一个序列,元素以列表的形式返回。"
]
},
{
@@ -1012,7 +1012,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.9"
}
},
"nbformat": 4,


+ 18
- 4
0_python/2_Print_Statement.ipynb View File

@@ -27,6 +27,13 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. 打印字符串"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
@@ -48,7 +55,7 @@
"metadata": {},
"source": [
"在Python中,**单引号**、**双引号**和**三引号**用于表示字符串。\n",
"* 大部分单引号用于声明一个字符。\n",
"* 大部分情况下单引号用于声明一个字符。\n",
"* 声明一行时使用双引号,声明段落/多行时使用三引号。"
]
},
@@ -155,6 +162,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. 打印格式化数据"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`%s` 用于引用包含字符串的变量。"
]
},
@@ -244,7 +258,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. 其他例子"
"## 3. 其他例子"
]
},
{
@@ -383,7 +397,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# 2. `PrecisionWidth`和`FieldWidth`"
"## 4. `PrecisionWidth`和`FieldWidth`"
]
},
{
@@ -592,7 +606,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.9"
}
},
"nbformat": 4,


+ 2
- 2
0_python/3_Data_Structure_1.ipynb View File

@@ -13,7 +13,7 @@
"source": [
"数据结构是计算机存储、组织数据的方式,简单来说是指相互之间存在一种或多种特定关系的数据元素的集合。\n",
"\n",
"Python中的数据结构设计的非常巧妙,使用起来非常方便,几乎绝大多数的数据结构都可以通过`list`, `tuple`, `dict`, `string`, `set`等表示,因此用户几乎不需要自己定义数据结构,仅仅使用Python内置的数据结构即可完成非常复杂的算法。"
"Python中的数据结构设计的非常巧妙,使用起来非常方便,几乎绝大多数的数据结构都可以通过`list`, `tuple`, `dict`, `string`, `set`等表示,因此用户几乎不需要自己定义数据结构,仅仅使用Python内置的数据结构即可实现非常复杂的算法和操作。"
]
},
{
@@ -2060,7 +2060,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.9"
}
},
"nbformat": 4,


+ 5
- 2
0_python/README.md View File

@@ -1,9 +1,12 @@

# 简明Python教程 (90分钟学会Python)

Python 是一门上手简单、功能强大、通用型的脚本编程语言。Python 类库极其丰富,这使得 Python 几乎无所不能,网站开发、软件开发、大数据分析、网络爬虫、机器学习等都不在话下。Python最主要的优点是使用人类的思考方式来编写程序,大多数情况下使用封装好的库能够快速完成给定的任务,虽然执行的效率不一定很高,但是极大的缩短了程序设计、编写、调试的时间,因此非常适合快速学习、尝试、试错。
Python 是一门上手简单、功能强大、通用型的脚本编程语言。

关于Python的安装可以自行去网络上查找相关的资料,或者参考[《安装Python环境》](../references_tips/InstallPython.md)。
* Python 类库极其丰富,这使得 Python 几乎无所不能,网站开发、软件开发、大数据分析、网络爬虫、机器学习等都不在话下。
* Python最主要的优点是使用人类的思考方式来编写程序,大多数情况下使用封装好的库能够快速完成给定的任务,虽然执行的效率不一定很高,但是极大的缩短了程序设计、编写、调试的时间,因此非常适合快速学习、尝试、试错。

关于Python的安装可以参考[《安装Python环境》](../references_tips/InstallPython.md),或者自行去网络上查找相关的资料。

![learn python](images/learn_python.jpg)



BIN
0_python/images/jupyter_shortcuts.png View File

Before After
Width: 658  |  Height: 535  |  Size: 75 kB Width: 658  |  Height: 535  |  Size: 74 kB

+ 1
- 1
README.md View File

@@ -49,9 +49,9 @@
- [optim/sgd](6_pytorch/1_NN/optimizer/6_1-sgd.ipynb)
- [optim/adam](6_pytorch/1_NN/optimizer/6_6-adam.ipynb)
- CNN
- [CNN Introduction](6_pytorch/2_CNN/CNN_Introduction.pptx)
- [CNN simple demo](demo_code/3_CNN_MNIST.py)
- [cnn/basic_conv](6_pytorch/2_CNN/1-basic_conv.ipynb)
- [cnn/minist (demo code)](./demo_code/3_CNN_MNIST.py)
- [cnn/batch-normalization](6_pytorch/2_CNN/2-batch-normalization.ipynb)
- [cnn/lr-decay](6_pytorch/2_CNN/3-lr-decay.ipynb)
- [cnn/regularization](6_pytorch/2_CNN/4-regularization.ipynb)


+ 20
- 4
references_tips/InstallPython.md View File

@@ -5,6 +5,7 @@
可以参考后面所列的`1.Winodws`或者`2.Linux`章节所列的将Python环境安装到计算机里。



## 1. Windows下安装

由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。镜像的使用方法可以参考:[Anaconda镜像的说明文档](https://mirrors.bfsu.edu.cn/help/anaconda/)
@@ -30,10 +31,12 @@ wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2020.11-Linux-x86_64
bash ./Anaconda3-2020.11-Linux-x86_64.sh
```

按照提示完成安装(记得需要自动加入环境变量的设置),**然后关闭终端,再打开终端**
按照提示完成安装(记得需要`自动加入环境变量`的设置),**然后关闭终端,再打开终端**



## 3. 设置软件源

### 3.1 设置conda软件源

参考这里的[conda安装和软件源设置说明](https://mirrors.bfsu.edu.cn/help/anaconda/)
@@ -51,12 +54,17 @@ conda config --set show_channel_urls yes
pip config set global.index-url 'https://mirrors.ustc.edu.cn/pypi/web/simple'
```



## 4. 安装常用软件

打开`conda`的命令行程序,输入下面的命令
```
conda install jupyter scipy numpy sympy matplotlib pandas scikit-learn
```



## 5. 安装PyTorch

```
@@ -71,12 +79,18 @@ pip3 install torchvision

### 6.1 Conda创建自己的环境
```
conda create -n xueshaocheng_pytorch
conda create -n <your_env>

# example
conda create -n machinelearning
```

### 6.2 Conda怎么激活自己的环境
```
conda activate xueshaocheng_pytorch
conda activate <your_env>

# example
conda activate machinelearning
```

### 6.3 Conda常用命令
@@ -100,9 +114,11 @@ conda env list
conda info --envs

# 删除环境
conda remove -n yourname --all
conda remove -n <your_env> --all
```



## 7. [Python技巧](python/)

- [pip的安装、使用等](python/pip.md)


Loading…
Cancel
Save