如何在SublimeText中运⾏Python程序
In this tutorial you will learn how to run python program in sublime text in windows.
在本教程中,您将学习如何在Windows的⾼级⽂本中运⾏python程序。
Just follow below steps to configure sublime text. The whole process is divided into two parts.
只需按照以下步骤配置崇⾼⽂本。 整个过程分为两部分。
第1部分:设置路径 (Part 1: Setting Path)
First of all you have to set the path of python installation directory in environment variable. You can skip this step if it is already done.
⾸先,您必须在环境变量中设置python安装⽬录的路径。 如果已经完成,则可以跳过此步骤。
1. Copy the path of python installation directory. In my case it looks like as shown below.
1.复制python安装⽬录的路径。 就我⽽⾔,如下所⽰。
C:\Users\TCP\AppData\Local\Programs\Python\Python36-32
C:\ Users \ TCP \ AppData \ Local \ Programs \ Python \ Python36-32
Note: Here TCP is the user name of my computer. It will be different in your case.
注意:此处的TCP是我计算机的⽤户名。 您的情况将有所不同。
2. Now right click on Computer and click on Properties option. Then select Advance system settings in left sidebar.
2.现在,右键单击计算机 ,然后单击属性选项。 然后在左侧栏中选择⾼级系统设置 。
3. Now click on Environment Variables and then under System variables select variable with name Path.
3.现在,单击环境变量 ,然后在系统变量下选择名称为Path的变量。
4. Click Edit button and then in Variable value field go to end and type semicolon and then paste the path of python directory that you copied. See below screenshot.
4.单击“ 编辑”按钮,然后在“ 变量值”字段中结束并键⼊分号,然后粘贴您复制的python⽬录的路径。 请参见下⾯的屏幕截图。
5. Finally click on all OK buttons to save the settings.
5.最后单击所有确定按钮以保存设置。
第2部分:安装SublimeREPL插件 (Part 2: Install SublimeREPL Plugin)
For taking input from user in sublime text we need a plugin named as SublimeREPL. So follow below steps to install it.为了接受来⾃⽤户的崇⾼⽂本输⼊,我们需要⼀个名为SublimeREPL的插件。 因此,请按照以下步骤进⾏安装。
1. Go to below link and copy the code according to your sublime text version.
1.转到下⾯的链接,然后根据您的崇⾼⽂本版本复制代码。
2. Open sublime and go to View > Show Console. Then in console box at bottom paste the code that you have just copied and press enter. Wait for few seconds, it will install required packages.
2.打开sublime并转到查看>显⽰控制台 。 然后在底部的控制台框中粘贴刚刚复制的代码,然后按Enter。 等待⼏秒钟,它将安装所需的软
件包。
3. Then go to Preferences > Package Control > Package Control: Install Package.
3.然后转到⾸选项>程序包控制>程序包控制:安装程序包。
4.在⽂本框中,输⼊SublimeREPL并选择它以安装插件。 安装后,重新启动sublime⽂本。
5. Now got to Tools > Build System > New Build System. A new file will open, just paste the following code in it.
5.现在进⼊Tools> Build System> New Build System 。 将打开⼀个新⽂件,只需将以下代码粘贴到其中。
{
"target": "run_existing_window_command",
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
6. Press ctrl + s and save it with file name Python_RUN.
6.按ctrl + s并将其保存为⽂件名Python_RUN 。
7. Go to Tools > Build System and select Python_RUN as build system or you can use ctrl + b as sho
rtcut.
7.转到⼯具>构建系统,然后选择Python_RUN作为构建系统,或者可以使⽤ctrl + b作为快捷⽅式。
8. For running a python program go to Tools > Build.
8.要运⾏python程序,请转⾄⼯具>构建。
sublime text3安装教程影⽚教学 (Video Tutorial)
Comment below if you are facing any problem to run python program in sublime text.如果您在升华⽂字中运⾏python程序时遇到任何问题,请在下⾯评论。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论