windows sublime text3 打造Python开发环境

1.开发环境:win10+Python2.7

Python 版本
2.install pip

如果你的Python版本满足Python 2 >=2.7.9 or Python 3 >=3.4,那么默认安装pip,你只需要upgrade pip.
参考https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip

更新后注意:

  • 添加环境变量
    windows sublime text3 打造Python开发环境_第1张图片
    添加环境变量
  • 在Git Bash中还是“bash: pip: command not found”,因为你安装的是windows环境的,而Git Bash中的文件系统是Linux的,所以还是老实的打开cmd,安装所需要的库吧


    pip
3.安装sublime text3的一些package
  • Sublime Text 3 安装Package Control
  1. 安装 SublimeREPL
    Ctrl+shift+p 键入 install packages;稍等片刻后 键入 SublimeREPL 安装即可
4.sublime text3点击ctrl+B无法运行Python程序?

只显示[Finished in 0.1s] 而不打印出hello world,怎么办?
1.打开sublime text 3 ,选择 tools-->Build System-->New Build System


windows sublime text3 打造Python开发环境_第2张图片
ctrl + s 命名为:Python.sublime-build

2.将下面代码块复制进新文件中,并命名为Python.sublime-build,保存(默认目录即可)

{
    "cmd": ["D:/Python27/python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}
windows sublime text3 打造Python开发环境_第3张图片
demo
5.如果有input 如何交互呢?设置F5快捷键

点击Pereferences-Browse Packages,进入Packages\SublimeREPL\config\Python ,编辑查看Default.sublime-commands 文件

windows sublime text3 打造Python开发环境_第4张图片
Paste_Image.png

复制里面有关‘Python - RUN current file’的一段Json到Pereferences-Key Bindings-User,并在每一个"caption"行前加一行 "keys":["fn"], n 根据自己习惯修改。
比如我给 Python - RUN current file 绑定的F5, 回到打开的python文件窗口,按F5执行就可以了。

[
 {
        "keys":["f5"],
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    }
]
   
windows sublime text3 打造Python开发环境_第5张图片
F5
windows sublime text3 打造Python开发环境_第6张图片
input

如果不设置快捷键的话:tools->sublimeREPL->python->python run current file,每次这样是不是超级麻烦。


windows sublime text3 打造Python开发环境_第7张图片

你可能感兴趣的:(windows sublime text3 打造Python开发环境)