- Brief introduction
- Installation
- Development tools
- Tips for using development tools
- Example
- Quick development (shortcut keys)
About 0X01
- How popular Python is
--ranked top five
-a language that must be mastered for development or operation
- Application fields
--Automation operations, cloud computing, virtualization, robotics and other technologies
- Application areas
--Large web site (Youtube, Google, NASA, watercress, know, pull hook net)
0x02 Installation
- Windows Environment Installation
1. Quick Installation
安装包下载:https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe开始安装:指定安装路径:C:\python27配置环境变量【右键计算机】-->【属性】-->【高级系统设置】-->【高级】-->【环境变量】-->【在第二个内容框中找到 变量名为Path 的一行,双击】--> 【Python安装目录追加到变值值中,用`;`分割】
Ps:
System Defaults ;``C:\python27
, remember that the previous分号
2. Detailed installation
- Install package Download:
Https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe
- Start installation
2.1 Running the installation package as an administrator
2.2 Selecting the Installation method
2.3 Check the installation function
2.4 Configuring Installation Road Strength
2.5 Installation Progress
2.6 Installation Success
2.7 Installation Complete directory and file condition (directory must be created first)
2.8 Start---> Run---> cmd
2.9 Start cmd
2.1 Run the Python command the first time
- Adding environment variables
3.1 My Computer---> Properties
3.2 Advanced Settings
3.2 System Properties
3.3 Environment Variables---> PATH---> Edit
3.4 Adding a program installation path
- Start cmd verification
4.1 Execute Python command to verify version information
- Linux Environment installation
Ps:
Linux system comes with Python environment, version is low
1.1 Viewing versions
python -V
1.2 Installing GCC
yum install -y gcc
1.3 Download Package
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
1.4 Decompression
tar xf Python-3.6.3.tar.xz
1.5 Compiling the installation
cd Python-3.6.3./configuremakemake install
1.6 Viewing version information
/usr/local/bin/python36 -V
1.7 Modifying the default Python version
mv /usr/bin/python /usr/bin/python2.6ln -s /usr/local/bin/python36 /usr/bin/python
1.8 Modifying the Yum source configuration
vi /usr/bin/yum将头部 #!/usr/bin/python 修改为 #!/usr/bin/python2.6
- Mac Environment Installation
< pending additions >
0X03 Development Tools
- Sublime Text
- Vim
- Pycharm
- Text Editor
0x04 Development tools Tips for use
Ps:
Here is the main introduction of Pycharm tools, the remainder of the later supplement
4.1 Development Tools Installation
- Pycharm
4.1.1 Website Address
Https://www.jetbrains.com
4.1.2 Installation
4.1.3 Specifying the installation path
4.1.4 Creating a shortcut
4.1.5 Start Installation
4.1.6 Installation Progress
4.1.7 completed
4.1.8 Generating Desktop icons
4.1.9 Startup program
4.1.10 Use protocol
4.1.11 Related Settings
4.1.12 Creating a new project
4.1.13 Creating project storage paths and associated programs
4.1.14 Startup program Complete
- Sublime Text
< pending additions >
4.2 Tips for using
- Pycharm Configuration
4.2.1 Setting up multi-version Python support
Setup steps:
File->settings->project Test->project Interpreter
4.2.2 Setting the window style and font size
Setup steps:
File--Settings->editor-Colors & Fonts
Style of the form after setting
4.2.3 automatically generate file information when creating a Python file
Setup steps:
File->setting->editot->code Style->file and Code Templates->python Script
File header information:
#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : ${DATE} ${TIME}# @Author : anChow# @File : ${NAME}.py
0x05 Example
5.1 Input and output
#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2018/3/28 18:20# @Author : anChow# @File : print.pyname = input("Please input your name: ")print("Hello {0}".format(name))print("Hello " + name)print("Hello %s" %name)
5.2 Basic use of modules
#!/usr/bin/env python# -*- coding: gbk -*-# @Time : 2018/3/28 18:20# @Author : anChow# @File : print.pyimport sysprint("程序名字:{0} ".format(sys.argv[0]))print("参数1 == {0}".format(sys.argv[1]))print("参数2 == {0}".format(sys.argv[2]))
5.2 Pycharm Setting file parameter settings
When no parameters are configured, an error is performed:
To bring up the configuration steps:
To configure parameter pass values:
Successful execution:
0x06 shortcut keys
6.1 Common shortcut keys
Ctrl + Z # 撤销Ctrl + A # 全选Ctrl + C # 复制Ctrl + V # 粘贴Ctrl + X # 剪切Alt + p # 浏览历史命令(上一条)Alt + n # 浏览历史命令(下一条)Ctrl + F6 # 重启shell,之前定义的对象和导入模块全部失效F1 # 打开python帮助文档Alt + / # 自动补全曾经出现过的单词Ctrl + ] # 缩进代码块Ctrl + [ # 取消代码块Alt + 3 # 注释代码快Alt + 4 # 取消代码块注释Tab # 补全
6.2 Debug Mode shortcut keys
F7: Step Into 相当于eclipse的f5就是 进入到代码F8: Step Over 相当于eclipse的f6 跳到下一步F9: resume programe 恢复程序或者执行到下一个断点
6.3 Related Operations
6.3.1 Linux Execution
# chmod +x test.py# ./test.py或 # python test.py
6.3.2 Windows execution
> Win + R> python test.py
6.3.3 Pycharm Execution
6.3.4 Pycharm Commissioning
Deployment of Python Basics