简体   繁体   English

Sublime Text 2中运行Python 32的问题

[英]Problems with running Python 32 in Sublime Text 2

I know that there are lots of questions about running Python in Sublime Text 2, but i have a problem. 我知道在Sublime Text 2中运行Python存在很多问题,但是我有一个问题。

I've changed "Python.sublime-build" file in AppData package on this one 我已在此AppApp包中更改了“ Python.sublime-build”文件

{
    "cmd": ["C:\\Program Files\\Python32\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

Where "C:\\Program Files\\Python32\\python.exe" is my own path. 其中“ C:\\ Program Files \\ Python32 \\ python.exe”是我自己的路径。 When I press Ctrl + B. I see "building..." and than the inscription disapeers and nothing happens. 当我按Ctrl + B时​​,我看到“ building ...”,然后铭文消失,什么也没有发生。

What to do. 该怎么办。 help me please! 请帮帮我!

You shouldn't be modifying any files in AppData/Roaming/Sublime Text 2/Packages/ unless they're in the User/ directory. 除非它们位于User/目录中,否则您不应在AppData/Roaming/Sublime Text 2/Packages/修改任何文件。 Any changes will be overwritten upon upgrade, and if you break something (unless you've made backups) you might not be able to fix it without reinstalling. 升级后,所有更改都将被覆盖,并且如果您破坏了某些内容(除非进行了备份),您可能需要重新安装才能修复它。

So, change Packages/Python/Python.sublime-build back to the following: 因此,将Packages/Python/Python.sublime-build更改回以下内容:

{
    "cmd": ["python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

Next, create a new file Packages/User/Python3.sublime-build with the following contents: 接下来,使用以下内容创建一个新文件Packages/User/Python3.sublime-build

{
    "cmd": ["c:/Program Files/Python32/python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

Save the file, then go to the Tools -> Build System menu and select Python3 . 保存文件,然后转到“ Tools -> Build System菜单,然后选择“ Python3 You should now be able to run a Python 3 file by hitting Ctrl B . 现在,您应该可以通过按Ctrl B来运行Python 3文件。 I'd suggest running the one below, as it will show if your Python installation is working properly: 我建议运行以下命令,因为它将显示您的Python安装是否正常工作:

import sys
print(sys.version)

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

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