1.编译型语言:源代码——>编译器——>可执行文件——>操作系统——>CPU
2.解释型语言:Python 源代码——>解释器(解释一句给一次OS)——>操作系统——>CPU
3.Python中一切皆对象,函数、模块、数字、字符串都是对象
4.Python拥有强大的标准库,如:time,datetime,random,hashlib,re,等,Python社区提供大量的第三方模块,使用方式与标准库类似,它们的功能覆盖 科学计算、人工智能、机器学习、Web开发、数据库接口、图形系统等多个领域。
5.Python:cmd---->python命令—>1)进入交互式环境2)python源代码编译
print(‘hello world’)
hello world
退出交互式环境:exit()
想要从C盘转到D盘,就输入d: ——>回车——>转到了D盘——>输入 cd 源代码路径——>dir——>就能看到该路径下的文件信息
C:\Users\Leanne>d:
返回上级目录:cd…
D:>cd D:\Python2020_2_1\python_source_code
D:\Python2020_2_1\python_source_code>dir
驱动器 D 中的卷是 DATA
卷的序列号是 9C0D-EA35
D:\Python2020_2_1\python_source_code 的目录
2020/02/16 20:50
2020/02/16 20:50
2020/02/16 20:50 0 hello.py
1 个文件 0 字节
2 个目录 915,694,866,432 可用字节
D:\Python2020_2_1\python_source_code>
这个时候,在该路径下python一下源文件就能得到该源文件的执行结果了。D:\Python2020_2_1\python_source_code>python hello.py
hello world
hello world
hello world
5.Python的库:1)标准库 Lib 2)第三方库 scripts
① pip一下就会告诉我们用法
D:\Python2020_2_1\python_source_code>pip
Usage:
pip [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
debug Show information useful for debugging.
help Show help for commands.
③ pip install requests 做爬虫要加载这个命令来安装相关的第三方库
④ pip install pillow 图形化的管理要加载这个命令来安装相关的第三方库
⑤ Pip install flask 做flask项目,还可以去指定版本 pip install django==2.0
⑥ Pip unstall 包名 卸载
⑦ Pip list 把安装的第三方包列举出来
Package Version
asgiref 3.2.3
certifi 2019.11.28
chardet 3.0.4
Django 3.0.3
idna 2.8
Pillow 7.0.0
pip 20.0.2
pytz 2019.3
requests 2.22.0
setuptools 41.2.0
sqlparse 0.3.0
urllib3 1.25.8
⑧ Pip freeze>requirements.txt
D:\Python2020_2_1\python_source_code>pip freeze >requirements.txt
在requirements.txt里面的内容:
asgiref3.2.3
certifi2019.11.28
chardet3.0.4
Django3.0.3
idna2.8
Pillow7.0.0
pytz2019.3
requests2.22.0
sqlparse0.3.0
urllib31.25.8
实现跨平台,通过requirements.txt(第三方包的版本)
Windows------->Linux
通过这个命令pip install -r requirements.txt在Linux中安装对应版本的第三方库
Windows :pip freeze >requirements.txt 将第三方的包一次性输出并存入requirements.txt文件中
Linux :pip install -r requirements.txt 一次性安装第三方的包