Python 2.7 and Sublime Text 2 Setup Guide

血红的双手。 提交于 2019-12-20 10:48:35

问题


I am new to Sublime Text 2. Basically I want to setup Sublime T2 as a Python IDE.

I have come across various questions with regards to Python and Sublime T2, but I couldn't find a guide from a beginners perspective. This is what I have done so far:

  1. Installed Python.
  2. Installed Sublime T2.
  3. Installed Sublime Package Control

What steps (e.g. package installations, etc.) should I follow to complete the Sublime Python IDE Setup?


回答1:


Besides Package Control, I use the following packages for Python development:

  • SideBarEnhancements
  • All Autocomplete
  • SublimeCodeIntel
  • GitGutter
  • Pylinter

I found SublimeCodeIntel and Pylinter to be especially helpful for writing Python code in Sublime Text.

Besides installing these packages you should also tweak some of Sublime's preferences. For example, Python can be quite picky about whitespace. Therefore I recommend taking extra care for setting up how Sublime handles whitespace. I'm using these settings (put them in Preferences -> Settings - User):

"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,

If you want to know more, I've written a blog post about setting up Sublime Text for Python development: https://dbader.org/blog/setting-up-sublime-text-for-python-development




回答2:


You should be able to select a build system in the tools menu.

Then, ctrl + B will build, and pull up the interpreter for you.

EDIT: ctrl + ` will also open your console, without building the project. From there, you can run Python commands with the built-in interpreter.




回答3:


I've documented my Sublime Text workflow here. Hope this helps.



来源:https://stackoverflow.com/questions/15257339/python-2-7-and-sublime-text-2-setup-guide

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