讲 课程导学 - Python 环境的安装和配置

00 - Python

Xinyu OU

. Python

Python PythonAI "2.Python"

1. Python

a. PythonPythonURL: b. Add Python 3.8 to PATH

2.

2.1 python

>> pip install --upgrade pip

2.2

numpy >> pip install numpy

scipy >> pip install scipy

3. Python

IDLE IDLE

print("Hello World!")

Hello World!

import numpy import scipy # import

. Python

1. Python

AnacondaPythonAnacondaPython URL

2. Notebook

NotebookAnacondaPython "" -> Anaconda3(64bit) -> Jupyter Notebook(Anaconda3)

3. JupyterLab

JupyterLabJupyterJupyter

3.1 JupyterLab

Anaconda Prompt (Anaconda3) >> conda install jupyterlab

JupyterLab >> conda update jupyter_core jupyter_client

3.2 JupyterLab ()

JupyterLabAnaconda Prompt (Anaconda3) jupyter labJupyterLabNotebook'C:\Users\Administrator' JupyterLab

>> jupyter notebook --generate-config

C:\Users\.jupyter\jupyter_notebook_config.py c.NotebookApp.notebook_dir C:\Users\AnacondaAnaconda Prompt (Anaconda3)

(*.bat)JupyterLab a.

C:\ProgramData\Anaconda3\Scripts\jupyter-lab.exe D:\CloudStation\MyWebsites\Teaching\ComputerMath\

JupyterLabUser

b. JupyterLab.bat.bat

c. (*.bat)

4. Visual Studio Code (VSCode)

4.1 VSCode

VSCodePythonHtml+CSSJavascript phpWebJavaC++C VSCodeURL

4.2 VSCode ()

VSCode Extensions4Ctrl+Shift+X Install

Settings Sync Alt+Shift+U/D/ Settings SyncGithub Settings Sync Settings Sync

Ctrl+Shift+P Configure Display LanguageChinese (Simplified) Language Pack for Visual Studio Code VSCodeVSCode

Flake8 SettingFlake Python > Linting: Flake8 Enabled

PythonPython (Microsoft) Bracket Pair Colorizer 2+++ indent-rainbow Guides vscode-icons Extensions

Alt+Shift+F

Pythonpylint settings.json "python.linting.pylintArgs":["?generate-members"]

.

1. Python123

Python :

2. Notebook

Jupyterlab Notebook html pygis

.

PythonNumpyScipyAnaconda PythonPython

1. Numpy

NumpyPythonArray Numpyscikit-learn scikit-learn RUNOOBNumpy ml [ Numpy]

# importnumpy "np"numpy import numpy as np

# i, i = np.array([[12,34,56],[78,90,11]])

# i print("i = \n{}".format(i))

i = [[12 34 56]

[78 90 11]]

2. Scipy

ScipyPython Scipysparse 0npsparse()

# scipyfrom import numpy as np from scipy import sparse

# numpyeye()66 # 1 0 matrix = np.eye(6)

# np CSRScipy (sparse matrix) sparse_matrix = sparse.csr_matrix(matrix)

# print("\n{}".format(matrix))

[[1. 0. 0. 0. 0. 0.]

[0. 1. 0. 0. 0. 0.] [0. 0. 1. 0. 0. 0.] [0. 0. 0. 1. 0. 0.] [0. 0. 0. 0. 1. 0.] [0. 0. 0. 0. 0. 1.]]

# CSR print("CSR\n{}".format(sparse_matrix))

CSR (0, 0) 1.0 (1, 1) 1.0 (2, 2) 1.0 (3, 3) 1.0 (4, 4) 1.0 (5, 5) 1.0

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download