为什么 Python 不能在 Atom 中运行? [英] Why can't Python run in Atom?

查看:31
本文介绍了为什么 Python 不能在 Atom 中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同的地方(包括 stackoverflow)对此进行了研究,但找不到对我有帮助的答案.

I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.

我使用的是 64 位 Windows 7,以及适用于 64 位 Windows 的 Atom.我在 C:UsersAustinDocumentsPython 目录中安装了 Python 3.6.1.当我尝试运行一个简单的脚本来在 Atom 中测试 Python 时,它说

I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:UsersAustinDocumentsPython. When I try to run a simple script to test Python in Atom, it says

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

'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s]

我尝试在命令行中运行相同的脚本,它说同样的话.我是编程新手,所以请耐心等待.

I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.

推荐答案

您的问题可能是您的 Python 命令未列在您的 PATH 环境变量中.

Your issue is probably that your Python command is not listed in your PATH environment variable.

环境变量是由您的操作系统存储并由您使用的操作系统和不同应用程序全局使用的路径、值和其他信息.

Environment Variables are paths, values and other information stored by your operating system and used globally by the OS and different applications you use.

PATH 环境变量中列出的命令的最佳示例是 cmdping.尝试点击 Win+R 并输入 cmd,注意它如何打开一个新的命令行,即使你真的不知道 cmd.exe 是否存储在您的硬盘上?这是因为路径 C:WindowsSystem32 存储在您的 PATH 变量中.

The best example for a command listed in the PATH environment variable is cmd or ping. try to tap Win+R and type cmd, note how it opens a new Command Line even though you don't really know where cmd.exe is stored on your hard drive? That is because the path C:WindowsSystem32 is stored in your PATH variable.

所以,我们知道您安装了 python,但是您希望能够在不指定路径的情况下运行它,我们该怎么做?只需将其添加到我们的环境变量中即可:

So, we know you installed python, but you want to be able to run it without specifying it's path, how can we do that? Simply add it to our environment variables:

  1. 使用键盘快捷键 Win+Pause
  2. 点击高级系统设置
  3. 在窗口底部点击Environment Variables...
  4. System Variables 部分找到 PATH 变量
  5. 双击它
  6. 一个带有文本框的新窗口已经打开,使用 end 按钮转到它的结尾
  7. 粘贴路径 C:UsersAustinDocumentsPython 在它的末尾(如果没有,请确保在粘贴之前添加一个 ;.
  8. 点击确定
  9. 打开一个新的cmd窗口
  10. 尝试输入 python 你现在应该已经在命令行和 Atom 中设置好了.
  1. Use the keyboard shortcut Win+Pause
  2. Click on Advanced system settings
  3. At the bottom of the window click on Environment Variables...
  4. In the System Variables section find the PATH variable
  5. Double click it
  6. A new window with a text box has opened, go to it's end with the end button
  7. Paste the path C:UsersAustinDocumentsPython at it's end (be sure to add a ; before pasting if there isn't one there.
  8. Click ok
  9. Open a new cmd window
  10. Try and type python you should be all set now, on the command line and in Atom.

如果不清楚,win 按钮是键盘上带有 Windows 图标的按钮.

If it isn't clear, the win button is the button on your keyboard with the windows icon on it.

这篇关于为什么 Python 不能在 Atom 中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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