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

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

问题描述

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

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

我正在使用Windows 7(64位)和Atom(用于64位Windows).我在目录C:\ Users \ Austin \ Documents \ Python中安装了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:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says

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

'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:\Windows\System32存储在您的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:\Windows\System32 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 + 暂停
  2. 点击Advanced system settings
  3. 在窗口底部,单击Environment Variables...
  4. System Variables部分中找到PATH变量
  5. 双击它
  6. 打开了一个带有文本框的新窗口,按 end 按钮结束它
  7. 在路径C:\Users\Austin\Documents\Python的最后粘贴(如果没有,请确保在粘贴之前添加;.
  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:\Users\Austin\Documents\Python 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天全站免登陆