简体   繁体   English

如何更改 Atom 使用的默认版本 Python?

[英]How can I change the default version of Python Used by Atom?

I have started using Atom recently and for the past few days, I have been searching on how to change the default version used in Atom (The default version is currently python 2.7 but I want to use 3.6).我最近开始使用 Atom,在过去的几天里,我一直在寻找如何更改 Atom 使用的默认版本(默认版本当前为 python 2.7,但我想使用 3.6)。 Is there anyone I can change the default path?有没有人可以更改默认路径? (I have tried adding a profile to the "script" package but it still reverts to python 2.7 when I restart Atom. Any help will be hugely appreciated.! Thank you very much in advance. (我曾尝试向“脚本”package 添加配置文件,但当我重新启动 Atom 时它仍然恢复为 python 2.7。非常感谢任何帮助。!提前非常感谢。

I am using script 3.18.1 in Atom 1.32.2 我在Atom 1.32.2中使用脚本3.18.1

Navigate to Atom (at top left) > Open Preferences > Open Config folder. 导航到Atom(位于左上方)>打开首选项>打开配置文件夹。

Now, Expand the tree as script > lib > grammars 现在,将树扩展为脚本> lib>语法

Open python.coffee and change 'python' to 'python3' in both the places in command argument 打开python.coffee并在命令参数的两个位置将``python''更改为``python3''

I would look in the atom installed plugins in settings.. you can get here by pressing command + shift + p, then searching for settings. 我会在设置中查看原子安装的插件。.您可以通过按Command + shift + p,然后搜索设置来到达此处。

The only reason I suggest this is because, plugins is where I installed swift language usage accessibility through a plugin that manages that in atom. 我建议这样做的唯一原因是,插件是我通过可自动管理原子的插件安装的快速语言用法可访问性。

Other words for plugins on atom would be "community packages" 原子上的插件的其他词就是“社区包”

Hope this helps. 希望这可以帮助。

Yes, there is. 就在这里。 After starting Atom, open the script you wish to run. 启动Atom之后,打开要运行的脚本。 Then open command palette and select 'Python: Select interpreter'. 然后打开命令选项板,然后选择“ Python:选择解释器”。 A list appears with the available python versions listed. 将显示一个列表,其中列出了可用的python版本。 Select the one you want and hit return. 选择一个您想要的然后点击回车。 Now you can run the script by placing the cursor in the edit window and right-clicking the mouse. 现在,您可以通过将光标置于编辑窗口中并右键单击鼠标来运行脚本。 A long menu appears and you should choose the 'Run python in the terminal window'. 出现一个长菜单,您应该选择“在终端窗口中运行python”。 This is towards the bottom of the long menu list. 这位于长菜单列表的底部。 The script will run using the interpreter you selected. 该脚本将使用您选择的解释器运行。

I came up with an inelegant solution that may not be universal.我想出了一个可能不通用的不优雅的解决方案。 Using platformio-ide-terminal, I simply had to call python3.9 instead of python or python3.使用 platformio-ide-terminal,我只需调用 python3.9 而不是 python 或 python3。 Not sure if that is exactly what you're looking for.不确定这是否正是您要找的。

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

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