Anaconda+Sublime环境搭建配置教程
(白宁超 2018年8月29日15:42:09)
摘要:随着机器学习和深度学习的热潮,各种图书层出不穷。然而多数是基础理论知识介绍,缺乏实现的深入理解。本系列文章是作者结合视频学习和书籍基础的笔记所得。本系列文章将采用理论结合实践方式编写。首先介绍机器学习和深度学习的范畴,然后介绍关于训练集、测试集等介绍。接着分别介绍机器学习常用算法,分别是监督学习之分类(决策树、临近取样、支持向量机、神经网络算法)监督学习之回归(线性回归、非线性回归)非监督学习(K-means聚类、Hierarchical聚类)。本文采用各个算法理论知识介绍,然后结合python具体实现源码和案例分析的方式)
1 Anaconda和Sublime配置
1 安装Anaconda集成环境,Anaconda下载,安装下一步一路安装结束。(无需环境变量配置),配置完成后,查看是否成功。
2 打开cmd进入dos命令下,输入conda list 查看集成的python包
3 如果想添加新的python包,打开Anaconda官网:https://anaconda.org/search进行查找,比如想找到机器学习工具包scikit-learn
4 可以将Anaconda集成到PyDev、Pycharm、Eclipse、VS等编译环境即可,本文介绍集成到sublime中,首先进入官网下载sublime
5 直接进行下一步安装,一路到底。成功后显示:
6 安装Package Control: https://packagecontrol.io/installation
7 复制6中标记红色的文本内容(如下),然后右击红色小框,选择Console,将代码如下所示的放入文本框中,按Enter即可。
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
8 完成7步骤后,按ctrl+shift+p打开如下窗口,并点击标红处,然后对应插件的下载和安装
9 下图输入框安装如下插件:
ConvertToUTF8 :解决中文问题
Colorsublime - Themes:Colorsublime 的主题集合
SublimeREPL:Python运行
SideBarEnhancements:侧栏增强功能
Alignment:自动对齐,ctrl+alt+a
Anaconda:python插件集合,禁用PEP8提示:Sublime > Preferences > Package Settings > Anaconda > Settings – User: {"anaconda_linting": false}
SublimeLinter-pep8
根据需要自行添加插件
10 主题配置:打开 Preferences > Settings (若报错,注意下图红色标记内容color_scheme整行替换)
{ "auto_indent": true, "bold_folder_labels": true, "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", "draw_white_space": "all", "font_size": 20, "font_face": "微软雅黑", "highlight_line": true, "ignored_packages": [ ], "preview_on_click": false, "rulers": [ 100 ], "save_on_focus_lost": true, "scroll_past_end": true, "show_encoding": true, "show_full_path": true, "show_line_endings": true, "smart_indent": true, "tab_size": 4, "translate_tabs_to_spaces": true, "trim_automatic_white_space": true, "trim_trailing_white_space_on_save": true, "use_tab_stops": true, "word_wrap": true, "wrap_width": 80 }
11 自定义快捷键盘配置:打开Preferences > Key Bindings输入如下代码,F5运行程序,F6切换IDEL工具,ctrl+d自定义删除行,其他快捷键是通用的,网上很多快捷键的资料,这里不赘述。
[ { "keys": ["f5"], "caption": "SublimeREPL: Python - RUN current file", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } }, { "keys": ["f6"], "caption": "SublimeREPL: Python", "command": "run_existing_window_command", "args": { "id": "repl_python", "file": "config/Python/Main.sublime-menu" } },{ "keys": ["ctrl+d"], "command":"run_macro_file", "args": {"file":"res://Packages/Default/Delete Line.sublime-macro"} } ]
12 分屏:ctrl+shift+1单屏,ctrl+shift+2左右分屏,ctrl+shift+8上下分屏,
![](https://yqfile.alicdn.com/img_983b77b7a198f8d25151a8af0e663d9a.png?x-oss-process=image/resize,w_1400/format,webp)
13 如果没有自动提示,可以如下配置,打开Preferences >Package Settings >Anaconda >Setting Default输入:Administrator改为你计算机的名字
"python_interpreter": "C:/Users/Administrator/Anaconda3/python.exe"
打开Preferences >Package Settings >Anaconda >Setting Users输入:Administrator改为你计算机的名字
{ "python_interpreter":"C:/Users/Administrator/Anaconda3/python.exe", "suppress_word_completions":true, "suppress_explicit_completions":true, "complete_parameter":true, }
到此,完成全部配置工作
2 Anaconda
- Anaconda理论介绍
- Anaconda简介及安装教程
- Windows下Anaconda的安装和简单使用
- 官网anaconda配置教程
- ANACONDA DISTRIBUTION
- 简单⾼效地进⾏科学计算 : Python和Anaconda
3 PHP+Sublime开发
官网下载:http://www.sublimetext.com/3
安装基本控件包:https://packagecontrol.io/installation
Ctrl+Shift+P 打开Package Control来安装插件:
ConvertToUTF8
Bracket Highlighter:括号补全
DocBlockr:文档注释
Emmet:自动生成html
SideBar Enhancements:边栏
{ "keys": ["ctrl+shift+c"], "command": "copy_path" },
//chrome
{ "keys": ["f5"], "command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\Users\\Administrator\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
"extensions":".*"
}
}
Themr:主题
Javascript Completions:js检查
SublimeCodeIntel:代码补全
SublimeLinter:代码检查
Alignment:自动对齐
PHP代码语法正确性验证插件 SublimeLinter
SublimeLinter SublimeLinter-php
安装完插件以后去配置一下插件相关配置,在 Sublime Text 3菜单打开:Preferences -> Package Setting -> SublimeLinter -> Setting User,把如下内容填充进去:
{ "user": { "debug": false, "delay": 0.25, "error_color": "D02000", "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme", "gutter_theme_excludes": [], "lint_mode": "background", "linters": { "annotations": { "@disable": false, "args": [], "errors": [ "FIXME" ], "excludes": [], "warnings": [ "NOTE", "README", "TODO", "XXX", "@todo" ] }, "php": { "@disable": false, "args": [], "excludes": [] }, "summitlinter": { "@disable": false, "args": [], "excludes": [], "globals": "", "ignore": "channel", "limit": null, "only": "" } }, "mark_style": "outline", "no_column_highlights_line": false, "passive_warnings": false, "paths": { "linux": [], "osx": [], "windows": [ "C:\\wamp\\bin\\php\\php5.5.12" ] }, "python_paths": { "linux": [], "osx": [], "windows": [] }, "rc_search_limit": 3, "shell_timeout": 10, "show_errors_on_save": false, "show_marks_in_minimap": true, "sublimelinter": "save-only", "sublimelinter_executable_map": { "php": "C:\\wamp\\bin\\php\\php5.5.12\\php.exe" }, "syntax_map": { "html (django)": "html", "html (rails)": "html", "html 5": "html", "javascript (babel)": "javascript", "magicpython": "python", "php": "php", "python django": "python", "pythonimproved": "python" }, "warning_color": "DDB700", "wrap_find": true } }
主题配置:打开 Preferences > Settings
{ "auto_indent": true, "bold_folder_labels": true, "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", "draw_white_space": "all", "font_size": 15.0, "highlight_line": true, "ignored_packages": [ ], "preview_on_click": false, "rulers": [ 100 ], "save_on_focus_lost": true, "scroll_past_end": true, "show_encoding": true, "show_full_path": true, "show_line_endings": true, "smart_indent": true, "tab_size": 4, "translate_tabs_to_spaces": true, "trim_automatic_white_space": true, "trim_trailing_white_space_on_save": true, "use_tab_stops": true, "word_wrap": true, "wrap_width": 80 }
sublime配置php
1 下载并安装WampServer集成环境
2 按win+R输入sysdm.cpl打开系统属性,配置环境变量C:\wamp\bin\php\php5.5.12
3 cmd命令窗体,输入命令php -h查看是否会提示php的命令使用方法
4 创建php编译系统,运行Sublime Text,选择Tool——>Build System——>New Build System,在新弹出的窗体中,
把默认内容
({ "shell_cmd": "make"}替换成
{ "cmd": ["php", "$file"], "file_regex": "php$", "selector": "source.php" }
保存在默认的目录下即可,注意修改文件名为 php.sublime-build 。
重启sublime text,就可以用Ctrl+B来编译.php文件了;