Python environment to build and sublime text configuration (to the novice)

Python Python is the first step to build an environment of learning, on this point, there are many online resources, methods varied. Due to work, own a colleague wrote a lot of processing Excel, reptiles code, also installed many times Python (with pyinstaller packaged into exe sometimes too), so I decided to write an article for beginners

Python environment to build

Direct installation Anaconda (500M +) on the line (too much can be installed Miniconda, about 70M)

What Anaconda that?

Anaconda is a release of Python, a collection of jupyter notebook, pip, ipython ...... anyway, for the novice you do not need to understand these things, put on the bin

 

Here two should be checked, do not be scared red, then added without manually checked on the system environment variables (for the uninitiated, reduce drag troublesome thing we engage in)

Once complete, we open the [Run] (win + r)

Enter cmd, OK, enter the command line, type python, then Enter

Python words appeared in front of the cursor changes to >>> prove that our computer has been configured Python language

 

sublime text 3 Configuration

Installation nothing to say, the official website to download and install on the line, said the following configuration

Open the newly installed sublime text 3, select the build environment

Then enter

Print ( "I'm good.")

 

Now run is not effective, because no py saved as a file, ctrl + s to save it as a file with the extension .py

Then return to the main screen, ctrl + b run

Chinese export success proves configured, but we also need to press a plug-in to support input

 

Ctrl + Shift + P, the control panel tune

Snipaste_2019-08-23_00-28-31.png

Enter Install, press Enter to select the first

Snipaste_2019-08-23_00-30-23.png

 

 

In the lower left corner of the display read, there is an equal sign in dangling

Snipaste_2019-08-23_00-32-19.png

Will pop up a list of installed plug-ins available for After reading success

Snipaste_2019-08-23_00-32-57.png

Installation SublimeREPL, the Sublime support input

Snipaste_2019-08-23_00-32-57.png

回车确认,左下角可以看到,安装中的提示

安装中.png

Ctrl + ` (esc下面的键)可以调出控制台,看后台运行情况,再按一次或者按 ESC 可以关闭

Snipaste_2019-08-23_00-38-02.png

安装好之后,我们试着来调用它:

word = input('人类的本质就是复读机,说点什么吧:\n')
while True:
   print(word)
   word = input('')

跟 Ctrl+B 直接编译不同,利用插件来编译需要我们先手动 Ctrl+S 保存

常规调用:

当然,每次这样子拿鼠标选的话真的很麻烦,所以我们设置一个快捷键来实现同样的功能

左边是系统默认设置,我们在右边窗口输入以下设置(另一个 Alt + End 是终止编译的快捷键),Ctrl+S 保存

[
{
   "keys": ["f4"],
   "caption": "SublimeREPL: Python - RUN current file",
   "command": "run_existing_window_command",
   "args": {
       "id": "repl_python_run",
       "file": "config/Python/Main.sublime-menu"}
  },
  { "keys": ["alt+end"], "command": "exec", "args": {"kill": true} }
]

这时候我们按 F4 (记得先保存 py 文件 ),会新建一个标签页运行

这样不方便切换,所以我们打开两个视图

这样就可以左右相互对照着看了

另外设置一下缩进,把 Tab 统一换成 四个空格 (因为有的电脑按 Tab 是一条横线)

在右侧输入以下内容:

{
"font_size": 15,
"ignored_packages":
[
"Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true
}

 

Guess you like

Origin www.cnblogs.com/xiha9012/p/11402981.html