如何从 Sublime text 3 运行 python? [英] How do I run python from Sublime text 3?

查看:58
本文介绍了如何从 Sublime text 3 运行 python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚得到了 python 和 sublime 3.当我按下 control + b 时,我在控制台中得到了这个:

I just got python and sublime 3. When I press control + b, I get this in the console:

'python' 不被识别为内部或外部命令,可运行的程序或批处理文件.

'python' is not recognized as an internal or external command, operable program or batch file.

它不会运行我惊人的代码!

And it won't run my amazing code!

print"Hi"

我确实安装了 Python,如何更改 PATH?

I do have Python installed, and how do I change the PATH?

推荐答案

如果您安装了 Python 2,则只需继续安装 Python 3,因为它是该语言的现在和未来.不要从 2 开始学习 Python,你会养成各种坏习惯.用 3 学习,然后在你能理解它们时回头找出与 2 的不同之处.我假设您使用的是 64 位系统,因为现在一切都是如此,因此请从 此处.如果不是,请获取这个.运行安装程序,然后选择显示将 Python 添加到我的路径"的选项(我忘记了它的确切位置).完成安装,重启 Sublime,它应该可以正常运行 python.exe.

If you installed Python 2, you'll need to just go ahead and install Python 3, as it's the present and future of the language. Don't starting learning Python with 2, you'll pick up all sorts of bad habits. Learn with 3, then go back and find out the differences with 2 when you can understand them. I'm assuming you're on a 64-bit system, as everything is these days, so download Python 3 from here. If you're not, get this one. Run the installer, and pick the option (I forget exactly where it is) that says "Add Python to my PATH". Finish the installation, restart Sublime, and it should pick up python.exe just fine.

顺便说一句,在 Python 3 中,print 是一个函数,所以你要运行的第一个代码应该是

BTW, in Python 3, print is a function, so your first code to run should be

print("Hi!")

不要忘记在构建前保存文件.

Don't forget to save the file before building.

哦,是的,避免像瘟疫那样艰难地学习 Python".糟透了.相反,先阅读官方教程,然后选择这里 和/或 这里.

Oh yeah, avoid "Learn Python the Hard Way" like the plague. It sucks. Instead, read the official tutorial first, then pick something here and/or here.

这篇关于如何从 Sublime text 3 运行 python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆