Windows 10에서 ML 개발 환경 구축하기

일단 python 개발 환경의 입장에서보면 WSL만으로는 역부족이다. 가장 중요한 GPU가 아직 WSL 1에서는 사용이 불가능해서 pytorch cpu만 실행 가능하기 때문이다. 게다가 Sublime text 3나 pycharm을 IDE로써 사용하려면 python binary가 IDE와 연결되어야하는데, WSL에 깔려있는 python은 윈도우에서 접근할 수가 없다. 그래서 WSL 2에서 GPU를 지원해주기 전까진, 현재로썬 무조건 anaconda3가 필요하다.

윈도우 용 Anaconda3 설치

링크에서 다운받아 설치한다. Anaconda에는 기본으로 jupyter도 설치되어 있고, wsl과 다른 ananconda prompt가 있다. 이것을 사용하면 된다. Anaconda를 설치하고 powershell prompt를 사용하면 기본 prompt보다 더 많은 기능이 지원되고, conda가 이미 설치되어 있어 바로 사용 가능하여 매우 편리하다.

Docker 설치

이 또한 장기적으로 WSL 2가 우분투와 완전히 동일한 사용성을 제공하게 되면, WSL 2에서 일반적인 우분투의 docker 설치 방법대로 깔아서 사용 가능하다. 그러나 WSL 1에서는 Docker for Windows를 설치한다음, 이를 WSL 1에서 호출하는 방식으로 사용해야한다.

Sublime text에 3-anaconda 패키지 설치하기

링크에서 다운받아 설치한다. 링크를 참조하여 ananconda가 사용할 python interpreter의 경로를 지정하고, 이를 build system에 등록한다.

그리고 sublime text의 build 옵션을 수정하여 anaconda의 python.exe를 가리키도록 한다. 링크 참조(Build System-New build system-"cmd":["C:\\ProgramData\\Anaconda3\\python.exe", "-u", "$file"] 추가하기. 그러면 해당 build 옵션은 다음 Sublime Text\\Data\\Packages\\User 경로 에 Py37Anaconda.sublime-build 이런 식으로 저장된다.)

설정이 완료되면, ctrl+B를 눌러 빌드를 할 수 있고 IDE에서 사용가능한 여러 기능들이 가능해진다.

Preferences-Package Setting-

{ 	"python_interpreter": "C:\\\\\\\\\\\\\\\\ProgramData\\\\\\\\\\\\\\\\Anaconda3\\\\\\\\\\\\\\\\python.exe", 	"auto_python_builder_enabled": true, }
{ 		"python_interpreter": "C:\\\\\\\\ProgramData\\\\\\\\Anaconda3\\\\\\\\python.exe",     "auto_python_builder_enabled": false,      "hide_snippets_on_completion":true,      // document     "enable_docstrings_tooltip": true,     "display_signatures": true,     "enable_signatures_tooltip":true,     "merge_signatures_and_doc":true,/*         Sets the linting behaviour for anaconda:          "always" - Linting works always even while you are writing (in the background)         "load-save" - Linting works in file load and save only         "save-only" - Linting works in file save only     */     "anaconda_linting": true,     "anaconda_linting_behaviour": "always",     "anaconda_linter_persistent": true,     "anaconda_linter_show_errors_on_save":false,     "anaconda_linter_phantoms":false, // show inline error       "pep8": false,     "pep8_rcfile": false,     "pep8_error_levels": {"E": "W", "W": "V", "V": "V"},     "pep8_ignore":         [             "E309"         ],     "pep257": false,     "pep257_ignore":     [         "D203",         "D209"     ],/*         If 'outline' (default), anaconda will outline error lines.         If 'fill', anaconda will fill the lines.         If 'solid_underline', anaconda will draw a solid underline below regions.         If 'stippled_underline', anaconda will draw a stippled underline below regions.         If 'squiggly_underline', anaconda will draw a squiggly underline below regions.         If 'none', anaconda will not draw anything on error lines.     */      "anaconda_linter_mark_style": "squiggly_underline",     "anaconda_linter_underlines": false, // redundant with above option      // If true, anaconda draws gutter marks on line with errors.     "anaconda_gutter_marks": true,     "anaconda_gutter_theme": "hard", // 'basic', 'alpha', 'bright', 'dark', 'hard', "retina", 'simple' }

Pycharm for anaconda 설치하기

만약 sublime이 아니라 pycharm을 원한다면, 링크에서 다운받아 설치한다.

Pytorch for anaconda 설치하기

  1. 설치방법 링크