简体   繁体   中英

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.

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!

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 Ctrl B . I'd suggest running the one below, as it will show if your Python installation is working properly:

import sys
print(sys.version)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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