Problems with running Python 32 in Sublime Text 2

随声附和 提交于 2019-12-24 21:58:09

问题


I know that there are lots of questions about running Python in Sublime Text 2, but i have a problem.

I've changed "Python.sublime-build" file in AppData package on this one

{
    "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. When I press Ctrl + B. I see "building..." and than the inscription disapeers and nothing happens.

What to do. help me please!


回答1:


You shouldn't be modifying any files in AppData/Roaming/Sublime Text 2/Packages/ unless they're in the User/ directory. 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:

{
    "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:

{
    "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. You should now be able to run a Python 3 file by hitting CtrlB. I'd suggest running the one below, as it will show if your Python installation is working properly:

import sys
print(sys.version)


来源:https://stackoverflow.com/questions/23065859/problems-with-running-python-32-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!