python學(xué)習

# Python 學(xué)習的過程

## 現(xiàn)在的環(huán)境

- Pycharm --用來寫網(wǎng)站,調(diào)試程序

- Jupyter notebook --用來爬蟲、大數(shù)據(jù)分析

- Typora --用來記錄日志

## 學(xué)習markdown的語法

# 標題1

## 標題2

### 標題3

#### 標題4

##### 標題5

###### 標題6

###### 標題7

### 無序列表

* 無序列表

+ 無虛列表

- 無序列表

### 有序列表

1. 有序的列表

2. 列表2

3. 列表3

### 引用

> 應(yīng)用1

>

> > 二級的應(yīng)用

>

> 引用2

> > > > 這個是好幾級的引用了

---

***

> 分割線

### 鏈接

[]()

### 表格

| name | age? | sex? |

| ---- | ---- | ---- |

| 張飛 |? ? ? |? ? ? |

| 關(guān)羽 | 20? | 男? |

*斜體*

**加粗的字體**

~~常用的基本上就這些了,如果還有一些常用的,可以跟我留言,~~

常用的基本上就這些了,如果還有一些常用的,

==可以跟我留言,我補充上去,==

我覺得圖文并茂才是高效學(xué)習的正確姿勢,但愿為你的學(xué)習帶來幫助!

ctrl + / 切換源碼和效果模式

888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

這個是自動換行的

### 流程圖

```mermaid

graph LR

A[方形] -->B(圓角)

? ? B --> C{條件a}

? ? C -->|a=1| D[結(jié)果1]

? ? C -->|a=2| E[結(jié)果2]

? ? F[橫向流程圖]

```

```mermaid

graph TD

A[方形] -->B(圓角)

? ? B --> C{條件a}

? ? C -->|a=1| D[結(jié)果1]

? ? C -->|a=2| E[結(jié)果2]

? ? F[豎向流程圖]

```

```flow

st=>start: 開始框

op=>operation: 處理框

cond=>condition: 判斷框(是或否?)

sub1=>subroutine: 子流程

io=>inputoutput: 輸入輸出框

e=>end: 結(jié)束框

st->op->cond

cond(yes)->io->e

cond(no)->sub1(right)->op

```

```sequence

對象A->對象B: 對象B你好嗎?(請求)

Note right of 對象B: 對象B的描述

Note left of 對象A: 對象A的描述(提示)

對象B-->對象A: 我很好(響應(yīng))

對象A->對象B: 你真的好嗎?

```

```mermaid

%% 語法示例

? ? ? ? gantt

? ? ? ? dateFormat? YYYY-MM-DD

? ? ? ? title 軟件開發(fā)甘特圖

? ? ? ? section 設(shè)計

? ? ? ? 需求? ? ? ? ? ? ? ? ? ? ? :done,? ? des1, 2014-01-06,2014-01-08

? ? ? ? 原型? ? ? ? ? ? ? ? ? ? ? :active,? des2, 2014-01-09, 3d

? ? ? ? UI設(shè)計? ? ? ? ? ? ? ? ? ? :? ? ? ? des3, after des2, 5d

? 未來任務(wù)? ? ? ? ? ? ? ? ? ? :? ? ? ? des4, after des3, 5d

? ? ? ? section 開發(fā)

? ? ? ? 學(xué)習準備理解需求? ? ? ? ? ? ? ? ? ? ? :crit, done, 2014-01-06,24h

? ? ? ? 設(shè)計框架? ? ? ? ? ? ? ? ? ? ? ? ? ? :crit, done, after des2, 2d

? ? ? ? 開發(fā)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :crit, active, 3d

? ? ? ? 未來任務(wù)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :crit, 5d

? ? ? ? 耍? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :2d


? ? ? ? section 測試

? ? ? ? 功能測試? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :active, a1, after des3, 3d

? ? ? ? 壓力測試? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :after a1? , 20h

? ? ? ? 測試報告? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : 48h

```

---------

[] java

[] python

### Typora快捷鍵

| 快捷鍵? ? ? | 作用? ? ? ? ? ? ? | 快捷鍵? ? ? | 作用? ? ? ? ? |

| ----------- | ------------------ | ------------ | -------------- |

| Ctrl+1? ? ? | 一階標題? ? ? ? ? | Ctrl+B? ? ? | 字體加粗? ? ? |

| Ctrl+2? ? ? | 二階標題? ? ? ? ? | Ctrl+I? ? ? | 字體傾斜? ? ? |

| Ctrl+3? ? ? | 三階標題? ? ? ? ? | Ctrl+U? ? ? | 下劃線? ? ? ? |

| Ctrl+4? ? ? | 四階標題? ? ? ? ? | Ctrl+Home? ? | 返回Typora頂部 |

| Ctrl+5? ? ? | 五階標題? ? ? ? ? | Ctrl+End? ? | 返回Typora底部 |

| Ctrl+6? ? ? | 六階標題? ? ? ? ? | Ctrl+T? ? ? | 創(chuàng)建表格? ? ? |

| Ctrl+L? ? ? | 選中某句話? ? ? ? | Ctrl+K? ? ? | 創(chuàng)建超鏈接? ? |

| Ctrl+D? ? ? | 選中某個單詞? ? ? | Ctrl+F? ? ? | 搜索? ? ? ? ? |

| Ctrl+E? ? ? | 選中相同格式的文字 | Ctrl+H? ? ? | 搜索并替換? ? |

| Alt+Shift+5 | 刪除線? ? ? ? ? ? | Ctrl+Shift+I | 插入圖片? ? ? |

- [? ]

- [X]

-

# pyechart

### 數(shù)據(jù)庫連接

? pycharm? SQLca.py

? jupyter import sqlca

地圖文件被分成了三個 Python 包,分別為:

全球國家地圖: echarts-countries-pypkg (1.9MB)

中國省級地圖: echarts-china-provinces-pypkg (730KB)

中國市級地圖: echarts-china-cities-pypkg (3.8MB)

直接使用python的pip安裝:

```html

pip install echarts-countries-pypkg

pip install echarts-china-provinces-pypkg

pip install echarts-china-cities-pypkg

```

這里要提醒大家,一定要注意,安裝完地圖包以后一定要重啟jupyter notebook,不然是無法顯示地圖的。

安裝完畢我們就可以直接畫圖了。

pip install echarts-countries-pypkg

### pycharm永久激活

激活

復(fù)制到

C:\P\PyCharm 2018.1\bin

? 2)修改文件

?? ? ? 上圖中標記的文件,pycharm.exe.vmoptions? pycharm.exe.vmoptions兩個文件

?? ? ? 在文件的末尾加上

-javaagent:C:\P\PyCharm 2018.1\bin\JetbrainsCrack-2.8-release-enc.jar

?? ? ? ? http://localhost:8888/?token=7c2467d686e339473c8ba57c329917deea5b0c0f6d2f65b1&token=7c2467d686e339473c8ba57c329917deea5b0c0f6d2f65b1

### mysql + dataframe + echart

```

from pyecharts import Line3D

from pyecharts import Geo

from pyecharts import GeoLines, Style, Bar, Radar

from pyecharts import Map

from pyecharts import Gauge

from pyecharts import Bar, Line, Scatter, EffectScatter, Grid, Kline

import simplejson as json

import numpy as np

import pandas as pd

from pandas import DataFrame

conn = pymysql.connect(host = 'localhost',port = 3306,user = 'root',password = 'edit',db = 'mxonline3',charset='utf8')

cursor = conn.cursor()

sql_s = "select typen, count(*) f1, sum(order_m) as f2, sum(status) f3, max(order_m) f4, avg(order_m) f5 from myechart_ewsales group by typen"

columns_s = ["typen", "f1", "f2", "f3", "f4", "f5"]

#cursor.execute(sql)

#result = cursor.fetchall()

df = pd.read_sql(sql_s, conn, columns=columns_s)

df

```

### 知識庫的后續(xù)工作

#### 1 、完善我發(fā)的課程

以下都在 course\adminx.py 中修改

* Uediter 問題(聯(lián)動狀態(tài))

? 聯(lián)動沒有弄好,先取消了

? ```

? # inlines = [LessonInline, CourseResourceInline]

? ```

* 只能管自己的文章,找到簡單方法了

* 課程(用的自己email + 父教師email)

* ```

? def queryset(self):

? ? ? qs = super(MyCourseAdmin, self).queryset()

? ? ? # qs = qs.filter( teacher__email=self.request.user.email )

? ? ? qs = qs.filter( Q(teacher__email=self.request.user.email) | Q(email=self.request.user.email))


? ? ? return qs


? def save_models(self):

? ? ? self.new_obj.email = self.request.user.email

? ? ? super().save_models()

? ```

* 章節(jié)(用的關(guān)聯(lián))

? ```

? def queryset(self):

? ? ? if not self.request.user.is_superuser:? # 用戶可查看自己的文章

? ? ? ? ? qs = super(LessonAdmin, self).queryset()

? ? ? ? ? # qs = qs.filter(course__name_)

? ? ? ? ? qs = qs.filter(Q(course__teacher__email=self.request.user.email) | Q(course__email=self.request.user.email))

? ? ? else: # 超級用戶可查看所有數(shù)據(jù)

? ? ? ? ? qs = super(LessonAdmin, self).queryset()

? ? ? return qs

? ```

* 視頻(沒有搞清楚視頻外鏈)

* 上傳到 優(yōu)酷 審核中

* ```

? def queryset(self):

? ? ? if not self.request.user.is_superuser:? # 用戶可查看自己的文章

? ? ? ? ? qs = super(VideoAdmin, self).queryset()

? ? ? ? ? # qs = qs.filter(course__name_)

? ? ? ? ? qs = qs.filter(Q(lesson__course__teacher__email=self.request.user.email) | Q(lesson__course__email=self.request.user.email))

? ? ? else: # 超級用戶可查看所有數(shù)據(jù)

? ? ? ? ? qs = super(VideoAdmin, self).queryset()

? ? ? return qs

? ```

* 上傳材料

* ```

? class CourseResourceAdmin(object):

? ? ? list_display = ['course', 'name', 'download', 'add_time']

? ? ? search_fields = ['course', 'name', 'download']

? ? ? list_filter = ['course__name', 'name', 'download', 'add_time']


? ? ? model_icon = 'fa fa-briefcase'


? ? ? def queryset(self):

? ? ? ? ? if not self.request.user.is_superuser:? # 用戶可查看自己的文章

? ? ? ? ? ? ? qs = super(CourseResourceAdmin, self).queryset()

? ? ? ? ? ? ? # qs = qs.filter(course__name_)

? ? ? ? ? ? ? qs = qs.filter(Q(course__teacher__email=self.request.user.email) | Q(course__email=self.request.user.email))

? ? ? ? ? else: # 超級用戶可查看所有數(shù)據(jù)

? ? ? ? ? ? ? qs = super(CourseResourceAdmin, self).queryset()

? ? ? ? ? return qs

? ```

#### 2、專家組權(quán)限維護

users_userprofile_groups

#### 3、快速維護

### 4、考試系統(tǒng)

```

http://119.97.214.18:5082/login.thtml? 這個在線考試

user: 韋政 pwd editedit

```

## 數(shù)據(jù)統(tǒng)計

| 用戶統(tǒng)計 | 正常 : 102 , 待審核 : 3 , 鎖定 : 0? ? ? ? ? ? ? ? ? ? ? ? ? |

| -------- | ------------------------------------------------------------ |

| 題庫統(tǒng)計 | 題庫數(shù)量 : 8 , 試題數(shù)量 : 526? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

| 試題統(tǒng)計 | 單選題 : 269 , 多選題 : 84 , 判斷題 : 2 , 填空題 : 40 , 問答題 : 127 |

| 試卷統(tǒng)計 | 試卷數(shù)量 : 6 , 進行中 : 0 , 已結(jié)束 : 6? ? ? ? ? ? ? ? ? ? ? |

| 資源統(tǒng)計 | 資源數(shù)量 : 0? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

# jupyterLab

```

cd C:\waterxp\python\jupyter\

jupyter lab

pip install jupyterlab? -i https://pypi.doubanio.com/simple

```

### password

from notebook.auth import passwd

passwd()

token=f4f0efd71900af47d1424a231bf2241237e813734246437f

```

'sha1:5f16bb13f186:cafac0d4ad19c4dec424479896846e6c748fb44e'

```

passwd()

---------------------

### pandas

#### 透視表

df.pivot_table(index = 'A', columns = '', aggfunc = {'x1'.count(), 'x2'.sum()})

# jupyter

### 我電腦的 kupyter notebook

事實

cmd 下沒有 dashboard

在 conda 環(huán)境下就有 dashboard

#### 自啟動 寫入 autorun.bat

? cd C:\waterxp\python\jupyter

? jupyter notebook --no-browser --port 8003? --ip=0.0.0.0

?

#### 加入自啟動文件夾

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

?

#### 設(shè)置密碼 editedit

* 執(zhí)行

C:\waterxp\python\jupyter>jupyter notebook --generate-config

Overwrite C:\Users\vivian\.jupyter\jupyter_notebook_config.py with default config? [y/N]n

* 生成

C:\Users\vivian\.jupyter\jupyter_notebook_config.py

* 算出密碼

passwd()

Warning: Password input may be echoed.

Enter password: >? editedit

Warning: Password input may be echoed.

Verify password: >? editedit

Out[3]:

'sha1:6006ec0f7c71:2c549a8f4d7272034d2422ec6a323507298ca969'

* 設(shè)置密碼

C:\Users\vivian\.jupyter\jupyter_notebook_config.py

-- 寫入

```

c.NotebookApp.ip='0.0.0.0'

c.NotebookApp.password = u'sha1:6006ec0f7c71:2c549a8f4d7272034d2422ec6a323507298ca969'

c.NotebookApp.open_browser = False

c.NotebookApp.port =8003

```

C:\Users\vivian\.jupyter\jupyter_notebook_config.json

--修改

?? ? "password": "sha1:6006ec0f7c71:2c549a8f4d7272034d2422ec6a323507298ca969"

* 重啟、登錄 OK-- editedit

# 服務(wù)器自動執(zhí)行

cd

python manage.py runserver 0.0.0.0127.0.01:8000

### jupyter主要快捷鍵

4.Markdown cell和code cell這兩種模式下的快捷鍵

? Ctrl + Enter: run the cell

? Shift + Enter: run the cell and select the cell below

? Alt + Enter: run the cell and insert a new cell below

? Ctrl + S: save the notebook

5.編輯模式下的快捷鍵

? Esc: switch to command mode

? Ctrl + Shift + -: split the cell

6.命令行模式下的快捷鍵

? Enter: switch to edit mode

? ↑ or k: select the previous cell

? ↓ or j: select the next cell

? y / m: change the cell type to code cell/Markdown cell

? a / b: insert a new cell above/below the current cell

? x / c / v: cut/copy/paste the current cell

? dd: delete the current cell

? z: undo the last delete operation

? Shift + =: merge the cell below

? h: display the help menu with the list of keyboard shortcuts

---

```

jupyter contrib nbextension install --sys-prefix

```

```

jupyter-dashboards-server --KERNEL_GATEWAY_URL=http://127.0.0.1:8889

```

### 代碼組成

這是一個非常另類的套裝, 由以下幾個部分組成

[jupyter/dashboards](https://link.jianshu.com?t=https://github.com/jupyter/dashboards), notebook 插件將代碼轉(zhuǎn)化為可定制的 dashboard

[dashboards_bundlers](https://link.jianshu.com?t=https://github.com/jupyter-incubator/dashboards_bundlers),notebook 插件將定制好的dashboard 輸出到 server端

[dashboards_server](https://link.jianshu.com?t=https://github.com/jupyter-incubator/dashboards_server),nodejs web框架,主要作用是與juypter server 通信展示只讀功能的dashboard

[kernel_gateway](https://link.jianshu.com?t=https://github.com/jupyter/kernel_gateway),一個中間的類似于代理的web框架,用于和dashboard server 通信

[dashboards_setup](https://link.jianshu.com?t=https://github.com/jupyter-incubator/dashboards_setup) ,一套基于docker的服務(wù)范例,講解各個服務(wù)如何配置

作者:ClarkMMM

鏈接:http://www.itdecent.cn/p/e872aad33eeb

## JUPYTER DASHBOARD SERVER

### jupyter_dashboards_bundlers

```

pip install jupyter_dashboards_bundlers -i https://pypi.doubanio.com/simple

jupyter bundlerextension enable --sys-prefix --py dashboards_bundlers

```

cd C:\waterxp\python\資料\dashboards_bundlers-master

python setup.py build

python setup.py install

pip install

- jupyter_dashboards 0.6.x

- jupyter_dashboards_bundlers 0.8.x

- ipywidgets 5.2.x

- jupyter_declarativewidgets 0.6.x

- matplotlib 1.5.x

- Bokeh 0.11.x

- Plotly 1.9.x

pip install jupyter_dashboards? -i https://pypi.doubanio.com/simple

- pip install? jupyter_dashboards_bundlers? -i https://pypi.doubanio.com/simple

- ipywidgets 5.2.x

- jupyter_declarativewidgets 0.6.x

- matplotlib 1.5.x

- Bokeh 0.11.x

- Plotly 1.9.x

# Jupyter Kernel Gateway

```

# install from pypi

pip install jupyter_kernel_gateway -i https://pypi.doubanio.com/simple

# show all config options

jupyter kernelgateway --help-all

# run it with default options

jupyter kernelgateway

```

C:\Users\vivian\.jupyter\jupyter_kernel_gateway_config.py

```

cd C:\waterxp\python\jupyter

jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 port=8003

jupyter kernelgateway --KernelGatewayApp.port=8003

[KernelGatewayApp] Jupyter Kernel Gateway at http://127.0.0.1:8889

```

```

jupyter-dashboards-server --KERNEL_GATEWAY_URL=http://127.0.0.1:8888

```

http://127.0.0.1:8003/nbextensions?nbextension=zenmode/main

修改擴展設(shè)置

from pyecharts import online

import IPython.core.display as di;

di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").length == 0) \? ? ? ? ? ? ? ? { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>', raw=True)

作者:大KKKK233

鏈接:http://www.itdecent.cn/p/bcd90bdaa87d

來源:簡書

簡書著作權(quán)歸作者所有,任何形式的轉(zhuǎn)載都請聯(lián)系作者獲得授權(quán)并注明出處。

# word

1 集中設(shè)置了8級標題,強調(diào)應(yīng)用

2 設(shè)置了默認字體 微軟雅黑 + arial

3. alt + shift + 左右 調(diào)整級別

4. 無序號 3層序列

5. 引用 直接用左邊邊框就可以實現(xiàn)

6. 層級序號

7. 默認首行縮進

----

# Docker

stevewei7777

![1538320018912](C:\Users\vivian\AppData\Roaming\Typora\typora-user-images\1538320018912.png)

未果,他不響應(yīng)1

# node.js

安裝? node-v7.6.0-x64

npm = Node.js的包管理工具(package manager)。

1、Node.js簡介

簡單的說 Node.js 就是運行在服務(wù)端的 JavaScript。Node.js 是一個基于 [Chrome V8](https://developers.google.com/v8/) 引擎的 JavaScript 運行環(huán)境。Node.js 使用了一個事件驅(qū)動、非阻塞式 I/O 的模型,使其輕量又高效。Node.js 的包管理器 [npm](https://www.npmjs.com/),是全球最大的開源庫生態(tài)系統(tǒng)。

在我安裝的文件夾【c:\p\nodejs】下創(chuàng)建兩個文件夾【node_global】及【node_cache】

```

npm config set prefix "c:\p\nodejs\node_global"

npm config set cache "c:\p\nodejs\node_cache"

```

進入環(huán)境變量對話框,在【系統(tǒng)變量】下新建【NODE_PATH】,輸入【c:\p\nodejs\node_global\node_modules】,

將【用戶變量】下的【Path】修改為【c:\p\nodejs\node_global】

# 了解一下 pytorch

算了,還是用 tf

# 研究下自動啟動 canda 下的jupyter

%windir%\System32\cmd.exe "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3

1. 編寫? C:\ProgramData\Anaconda3\Scripts\activate_jupyter.bat

2. @CALL "%~dp0..\Library\bin\conda.bat" activate %*

? cd C:\waterxp\python\jupyter

? jupyter notebook --no-browser --port 8003? --ip=0.0.0.0

3. 快捷方式加入到 程序\開發(fā) **"啟動jupyter"**中

# 研究下jupyter 的html 通過 TS4 轉(zhuǎn)換后發(fā)布到網(wǎng)站

### ew 知識庫中,課程顯示

顯示成幾天前修改

學(xué)習人員顯示昵稱

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容