简体   繁体   English

如何使用 atom 运行 python 脚本?

[英]How to run python script using atom?

I have been using atom code editor to write C code and run it using a gcc compiler, recently I started out on python code and have been trying to run python script using atom code editor but i keep on getting errors, is there a way to fix this?我一直在使用原子代码编辑器编写 C 代码并使用 gcc 编译器运行它,最近我开始使用 python 代码并一直尝试使用原子代码编辑器运行 python 脚本但我不断收到错误,有没有办法解决这个问题?

Having run C on atom should not interfere with you running python. 在Atom上运行C不会干扰您运行python。 Make sure you've installed the python extension and you name your file with the py extension. 确保已安装python扩展名,并使用py扩展名命名文件。 Also, install the 'script' extension. 另外,安装“脚本”扩展名。 Enter your script and hit command-I. 输入您的脚本,然后按Command-I。 The script extension should then run your script. 然后,脚本扩展名应运行您的脚本。 Command-I is just a shortcut to run script. Command-I只是运行脚本的快捷方式。 You can install these extensions (add-ons) by going to Preferences under the Atom menu item. 您可以通过转到Atom菜单项下的“首选项”来安装这些扩展(附加组件)。 This opens a window in Atom and you can install from a list of available extensions. 这会在Atom中打开一个窗口,您可以从可用扩展列表中进行安装。

可能需要更改在右下角选择的语言,请参见此处: https : //user-images.githubusercontent.com/31619951/31304897-b0900c7e-ab4a-11e7-803c-b34168895ed3.PNG如果仍然无法通过,则可能需要根据我正在阅读的github支持线程,卸载atom中的C ++软件包并重新安装atom-gpp-compiler

If you run atom-python-run and gpp-compiler at the same time it will show you this error.如果您同时运行atom-python-rungpp-compiler ,它将向您显示此错误。

So disabling gpp-compiler will not show this problem when you want to run Python. And when you run C then disabling atom-python-run and enable gpp-compiler will solve your problem.因此,当您想运行 Python 时,禁用gpp-compiler不会显示此问题。当您运行 C 时,禁用 atom-python-run 并启用gpp-compiler将解决您的问题。

I am a junior and this is the way I have solved my problem, please correct me if there is any mistake.我是大三学生,这就是我解决问题的方法,如有错误请指正。 And if anyone has an easier way, please share.如果有人有更简单的方法,请分享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM