<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>일상다반사(日常茶飯事) &amp;gt; 스터디 &amp;gt; 파이썬</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python</link>
<language>ko</language>
<description>파이썬 (2021-03-15 17:30:29)</description>

<item>
<title>파이썬, 무거운 아나콘다 대신 미니콘다 (설치 방법)</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=6</link>
<description><![CDATA[<p>원문 : <a href="http://hleecaster.com/installing-python-anaconda/" rel="nofollow">http://hleecaster.com/installing-python-anaconda/</a></p><p><br /></p><h2 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.6em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">파이썬 배포판 아나콘다(Anaconda)를 설치하는 이유</h2><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">파이썬을 설치한다는 건 쉽게 이야기하면 파이썬으로 짠 스크립트, 즉 파일 확장자가 <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">.py</code>인 파일을 실행할 수 있는 인터프리터를 설치한다는 뜻이다. 역시 가장 쉬운 방법은 사실 <a href="https://www.python.org/" rel="nofollow">파이썬 공식 웹사이트</a>에서 설치파일을 다운 받아 실행하는 거다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그런데 파이썬을 오래 사용하다 보면 다양한 라이브러리(패키지)를 추가로 설치하게 되고, 이 라이브러리들이 의존성 문제로 복잡하게 얽힐 수 있다. 당장은 어찌저찌 사용할 수 있지만 시간이 지나면 파이썬과 라이브러리들이 계속 업데이트 될 거고, 새로운 버전들끼리 또 서로 꼬여버리는 경우가 반드시 생긴다. 물론 가상환경 어쩌구 해가지고 어떻게든 잘 관리하면서 사용할 수도 있겠지만, 이런 성가신 문제 해결하느라 정작 파이썬으로 하고 싶은 걸 못 하고 성격만 나빠질 수 있다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그래서 배포판을 사용하면 좋다. 파이썬 배포판이란 파이썬 인터프리터, 표준 라이브러리 모듈, 디버거, 테스팅 도구, 통합 개발 환경(IDE), 사용자 설명서 등을 한 번에 설치할 수 있도록 묶어놓은 패키지를 말한다. ActivePython, CPython, Jython, WinPython 등이 있으나 가장 유명한 건 Anaconda.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">Anaconda(아나콘다)는 일반적인 용도의 개발을 위한 파이썬 인터프리터 뿐만 아니라 Numpy, Pandas, Matplotlib 등 1500개가 넘는 데이터 분석 패키지를 함께 제공하기 때문에 인기가 많다. 패키지 관리도 conda라는 시스템을 통해 쉽게 할 수 있다.</p><h2 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.6em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">아나콘다 vs 미니콘다</h2><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그런데 정작 아나콘다를 설치하려고 하면 너무 무겁다. 함께 설치되는 패키지가 정말 너무 많기 때문에 실제로 설치하려면 하드 용량도 3GB 정도 잡아먹고 설치 시간도 오래 걸린다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">이때 떠오르는 대안은 Miniconda(미니콘다), 아나콘다의 라이트 버전이다. 미니콘다는 정말 기본적인 요구 사항만 포함하고 있고, 내가 사용하는 패키지를 그때그때 설치해서 사용하면 그만이기 때문이다. 난 미니콘다로 설치했다.</p><h2 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.6em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">미니콘다 설치 방법 (아나콘다 동일)</h2><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">윈도우 기준으로 설명하자면 <a href="https://docs.conda.io/en/latest/miniconda.html" rel="nofollow">다운로드 페이지</a> 접속해서 내 PC 운영체제 확인 후 파이썬 버전 설치파일을 다운 받아 실행하면 끝이다. (PC 운영체제 확인은 Windows “설정” &gt; “시스템” &gt; “정보” 들어가면 확인할 수 있다. 보통 <strong>64비트 운영 체제, x64 기반 프로세서</strong>와 같은 식으로 써있다.)</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그런데 설치 파일 실행 후 진행 과정에서 유의해야 할 포인트가 좀 더 있긴 하다.</p><h3 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.4em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">설치 유형</h3><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">열심히 next를 누르다 보면 설치 유형을 선택하라고 한다.</p><img alt="" class="wp-image-6821 lazyloaded" src="https://cdn.shortpixel.ai/client/q_glossy,ret_img/http://hleecaster.com/wp-content/uploads/2020/04/miniconda1-1024x795.png" style="height:auto;" /><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">현재 로그인 한 사용자 전용으로 설치할 것인지(Just Me), 다른 사용자들도 모두 사용할 수 있도록 설치할 것인지(All Users) 골라야 한다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">Just Me가 권장(recommended) 값이다. 만약 All Users를 선택하면 나중에 추가 라이브러리를 설치하거나 가상 환경 설정할 때 관리자(Administator) 권한이 필요해서 오히려 더 불편해진다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">Just Me를 선택하자.</p><h3 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.4em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">설치 위치</h3><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">파이썬의 권장 설치 위치는 <strong>사용자 홈 디렉토리</strong>(<code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">내 PC</code> &gt; <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">로컬 디스크(C)</code> &gt; <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">Users</code> &gt; <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">사용자명</code>)이다.</p><img alt="" class="wp-image-6822 lazyloaded" src="https://cdn.shortpixel.ai/client/q_glossy,ret_img/http://hleecaster.com/wp-content/uploads/2020/04/miniconda2-1024x795.png" style="height:auto;" /><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그런데 이 때 <strong>사용자명에 공백이나 한글이 포함되지 않는 게 좋다.</strong> 공백이나 한글이 포함되어 있으면 특정 파이썬 모듈이 제대로 설치되지 않거나 동작에 이상이 있을 수 있기 때문이다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">만약 공백이나 한글이 포함되어 있다면 그냥 윈도우에 새 사용자를 추가해서 사용하는 게 안전하다. 사용자 홈 디렉토리 이름을 변경하는 건 매우 위험천만한 작업이기 때문에.</p><h3 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.4em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">고급 옵션</h3><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">설치를 마치는 시점에 고급 옵션을 선택하는 체크박스가 뜬다.</p><img width="1200" height="777" alt="" class="wp-image-6826 lazyloaded" src="https://i0.wp.com/hleecaster.com/wp-content/uploads/2020/04/miniconda3.png?fit=1024%2C468" style="height:auto;" /><h4 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.2em;font-family:'Open Sans';line-height:1.6;color:rgb(64,66,72);background-color:rgb(255,255,255);">Add Anaconda to my PATH environment variable</h4><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);"><strong>환경변수</strong>를 설정할지 결정해야 한다. 그런데 환경변수 설정하는 이유가 뭘까.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">별 거 아니고 그냥 명령 프롬프트(cmd) 창에서 파이썬 인터프리터를 실행할 때 그 파일의 세부 경로 없이 그냥 python이라고 칠 수 있도록 간편하게 등록을 해놓는 거다.</p><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">그런데 이 선택사항은 미니콘다 혹은 아나콘다 파이썬을 제거할 때를 포함하여 다양한 상황에서 예상치 못한 문제를 일으킬 수 있기 때문에, 그리고 결국엔 환경변수를 등록을 해놓지 않아도 파이썬 인터프리터를 사용할 수 있는 도구를 사용하게 되기 때문에 굳이 체크할 필요가 없다고 생각한다.</p><h4 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.2em;font-family:'Open Sans';line-height:1.6;color:rgb(64,66,72);background-color:rgb(255,255,255);">Register Anaconda as my default Python</h4><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">이번에 설치한 아나콘다(미니콘다) 파이썬을 <strong>기본 파이썬</strong>으로 인식하도록 하는 거다. 이전에 이미 다른 파이썬이 설치되어 있고 그걸 기본으로 사용하는 상황이라면 선택 해제 해야되지만, 이번에 설치한 걸 기본으로 쓸 거면 체크된 대로 두는 게 좋다.</p><h2 style="margin:0px 0px 0.8rem;padding:0px;font-size:1.6em;font-family:'Open Sans';line-height:1.6em;color:rgb(64,66,72);background-color:rgb(255,255,255);">패키지 관리 (conda, pip)</h2><p style="margin-bottom:20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);">이제 설치는 다 된 거고, 실제로 파이썬을 사용하려면 이런저런 라이브러리(패키지)를 추가로 설치하게 된다. 설치 및 관리할 때는 아래와 같은 우선순위를 생각하면 편하다.</p><ol style="margin:20px 0px;padding:0px 0px 0px 20px;color:rgb(64,66,72);font-family:Graphik, '-apple-system', BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;font-size:15px;background-color:rgb(255,255,255);"><li style="margin:10px 0px 0px;padding:0px;"><strong>conda</strong> : 아나콘다(미니콘다)에서는 패키지 목록 (<a href="https://docs.anaconda.com/anaconda/packages/pkg-docs" rel="nofollow">https://docs.anaconda.com/anaconda/packages/pkg-docs</a>)을 직접 관리하기 때문에 여기서 관리되는 패키지들은 <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">conda install</code> 명령어를 통해 설치한다.</li><li style="margin:10px 0px 0px;padding:0px;"><strong>conda-forge</strong> : 아나콘다 기본 저장소 conda에 포함되지 않은 일부 패키지들은 사용자들이 관리하는 conda-forge 저장소(<a href="https://conda-forge.org/" rel="nofollow">https://conda-forge.org</a>)에서 제공하기도 한다. 이것들은 <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">conda install -c conda-forge</code> 명령어를 통해 설치한다.</li><li style="margin:10px 0px 0px;padding:0px;"><strong>pip</strong> : 아나콘다 기본 저장소 conda나 conda-forge 저장소에서 제공하지는 않지만 <a href="https://pypi.org/" rel="nofollow">PyPI</a>에서 제공하는 패키지들은 표준 파이썬 패키지 관리도구인 pip를 이용하여 설치할 수 있다. (아나콘다나 미니콘다 설치해도 어차피 pip가 같이 설치되기 때문에) <code style="background:rgb(245,245,245);border:1px solid rgb(240,240,240);padding:1px 3px;color:rgb(220,20,60);font-family:consolas;">pip install</code> 명령어를 통해 설치한다.</li></ol>]]></description>
<dc:creator>nuno</dc:creator>
<dc:date>2021-03-15T17:30:29+09:00</dc:date>
</item>


<item>
<title>[펌] 0.PyQt5 시작 : Anaconda PyQt5 Pyinstaller 대강(Windows7 64bit)</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=5</link>
<description><![CDATA[<div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><b>펌 </b><a href="http://heideloon.egloos.com/3234738" style="font-family:'돋움', Dotum, Helvetica, sans-serif;font-size:12px;" rel="nofollow">http://heideloon.egloos.com/3234738</a></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;"><br /></strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ2019.4.17 최초 작성</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ과정</strong> : PyQt5를 사용해서 UI를 만들고, exe로 컴파일해서 실행해보는 부분까지</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ환경</strong> : Windows7 64bit</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ사용</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-Anaconda</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--QT Designer : UI 에디터 Tool</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--PyQT : UI 패키지</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--pyuic : UI -&gt; Py 변환</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--pyinstaller : py -&gt; exe 변환</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-PyCharm : 에디터 </div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ요약(설치-&gt;창띄우는 프로그램 실행까지)</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-Anaconda 설치 : <a href="https://www.anaconda.com/distribution/" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(49,128,218);" rel="nofollow">https://www.anaconda.com/distribution/</a></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">*Anaconda 설치를 설명해둔 블로그 : <a href="https://tariat.tistory.com/54" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(49,128,218);" rel="nofollow">https://tariat.tistory.com/54</a></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-QT Designer 실행 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">아나콘다 설치폴더/library/designer.exe</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">(혹은 /pkgs/~~로 길게 나열된 디렉토리에도 있는데.. 동일한 파일로 보이니 library꺼 사용)</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--UI 편집 후 저장 : test.ui</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-아나콘다 실행 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">Anaconda Prompt</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--PyQt5 최신버전으로 재설치 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pip install pyqt5</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">*아나콘다 설치하면 기본으로 깔려있긴 한데, 컴파일 과정에서 Module not found 오류가 발생했다. 재설치하니 해결</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--pyinstaller 설치 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pip install pyinstaller</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--ui 컴파일 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyuic5 test.ui -x -o test.py</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">* -x 옵션을 넣어야 창 띄우는 실행코드까지 생성된다!!! 명심</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">--exe 파일 생성 : <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyinstaller --onefile</strong> <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">test.py</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">* --onefile : 한개 exe에 다 넣기</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;기본적인 구성은 완료하였으므로 이제 내부 코드에 원하는 이벤트들을 붙여서 사용하면 됨</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">요약끝.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">-----------------------------------------------------------</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁ발단 및 설치</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">파이썬 UI 관련하여 찾아보니 생각보다 간단히 정리된 글이 없다... 파이썬으로 UI 짜는 사람이 적기 때문일까.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">여튼, 쓰려는 라이브러리가 있는데, 늘 자바나 자바스크립트, JSP 기반으로 프로그램을 짜던터라 이번에도 해당 방식을 고민했었는데, 하려고 보니 난관에 봉착. 자바 스크립트는 해당 라이브러리의 사용을 위해 Node.js 서버를 구동해야하는 이슈가 있고(나는 서버를 쓰면 안되는 환경) </div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">자바는 해당 라이브러리가 제공해주는 버전이 C 보다 낮은데다가 그 낮은 버전의 기능이 치명적으로 구리다..!</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">(라이브러리가 기본 C 구현에 자바 래핑이라 버전을 못따라가는듯)</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">그래서 울며 겨자먹기로 C기반의 프로그램을 고민하게 되었다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">MFC로 짤까 했는데 MFC와 C++은 본능적인 혐오가 있는지라 배제</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">기왕 하는거 파이썬이나 공부해볼까 하는 생각에 파이썬 기반의 UI를 찾아보기로 했다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">찾아보니 자바 스윙마냥 PyQt 라는 이름의 UI 지원 Tool이 있기에 고고싱~</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">따로 깔기 귀찮았는데 때마침 아나콘다(Anaconda)라는 패키지가 있더라.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">현재 기준 PyQt5가 최신이고 해당 버전을 지원해주길래 망설임 없이 설치</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">Anaconda : <a href="https://www.anaconda.com/distribution/" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(49,128,218);" rel="nofollow">https://www.anaconda.com/distribution/</a></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">*3.7버전 64bit graphical for window 로 설치</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">*설치할 때 보면 환경변수를 윈도우에 박을지 아닐지 선택하는 부분이 나온다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">default는 Off고 On은 비추천이라 함. 만일 체크하면 Dependancy 등등의 이유로 경고를 안내함.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">그래서 왜지 하고 보니 따로</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">Anaconda Prompt(윈도형식) 및</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">Anaconda Powershell Prompt(리눅스형식)를 제공해주기 때문이었다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">실제 아나콘다용 파이썬 쓸 때는 cmd 프롬프트가 아닌 제공해주는 프롬프트를 실행해서 할 것.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">에디터는 파이참이 좋다길래 설치</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">PyCharm : <a href="https://www.jetbrains.com/pycharm/download/#section=windows" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;color:rgb(49,128,218);" rel="nofollow">https://www.jetbrains.com/pycharm/download/#section=windows</a></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">*무료인 Community 버전 쓰자</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁQT Designer 사용</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">PyQt에서는 QT Designer 라는 프로그램으로 UI Tool을 제공해준다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">이클립스에서 자바스윙 연동하는 것처럼 기본 파이썬 에디터랑 결합해서 편집을 제공해주는 방법이 있으면 좋을텐데, 찾아본 바 그렇게까지는 제공해주지 않는듯.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">일단 안내해주는 방식은 UI, 코딩 따로였다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">사용하려고 보니 해당 프로그램은 따로 설치할 필요 없이 아나콘다를 설치하면 내장되어있다. 개꿀!</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">경로는 <strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">아나콘다 설치폴더/library/designer.exe</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">입맛대로 만든 후 .ui 파일로 저장하자.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁUI 프로그램 생성</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">Designer를 이용해서 UI 파일을 생성해준 후, 해당 UI를 파이썬에 띄우는 방법은 2가지정도가 있다고 한다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">1) py 소스코드에 ui 파일을 로드하여 사용</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">2) ui파일 자체를 py 코드로 변환하여 사용</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">위에서 1) 의 경우가 수정 보완이 좋다곤 하는데, 귀찮아서 배제...</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">2) 의 경우로 진행!!</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">ui파일을 py 코드로 변환하는데는 pyuic 라는 명령어를 사용해야 한다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">사용하는 PyQt5 에서는 pyuic5 버전으로 사용</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyuic5 test.ui</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"> : 위와같이 명령어를 적으면, 해당 UI가 어떤 코드로 변환되는지 콘솔에 출력해준다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">하지만 우리는 py 파일로 만들어야 하므로</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyuic5 test.ui <span style="color:rgb(204,0,0);">-o</span> test.py</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"> : -o 옵션을 통해 output 파일을 지정해주었다. 이렇게 하면 화면에 출력되던 py 코드가 파일로 저장된다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">하지만, 이렇게 하면 UI가 py 코드로 변환만 될 뿐, 실행 가능한 코드로 완성되진 않는다. 우리는 창을 띄우는 파이썬 코드를 만들어야 하므로</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyuic5 test.ui -o test.py <span style="color:rgb(204,0,0);">-x</span></strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"> : -x 옵션을 통해 UI 를 띄우는 실행 코드까지 포함한 파이썬 파일이 생성된다. 이렇게까지 하면 원하는 py 파일 완성!</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">python test.py</strong> 실행하면 실제 UI가 뜨는지 테스트할 수 있다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">ㅁexe 파일 생성</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">exe 파일을 생성해주는 방법중에 가장 간단한 방법은, pyinstaller를 설치하는 것이다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">anaconda 환경에서는</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pip install pyinstaller</strong> 명령어로 간단히 설치 가능.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">사용법 또한 간단하다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyinstaller test.py</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">매우간단.... 헌데 이렇게 만드는 경우 exe 파일 외 부산물들이 많이 생겨서 번거롭다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">그래서 있는 옵션이 exe 하나의 파일로 패키징하는 --onefile 옵션이다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">&gt;<strong style="margin:0px;padding:0px;border:0px;vertical-align:baseline;">pyinstaller <span style="color:rgb(204,0,0);">--onefile</span> test.py</strong></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">이렇게 하면 한개 파일로 프로그램이 생성된다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">창 하나만 해서 프로그램 만들어봤는데 용량이 34메가 ㅋㅋㅋㅋ UI 관련 라이브러리들 용량이 꽤 되는듯</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">이렇게 해서 완성!</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">이런저런 게시물들 찾으면서 혼재되어있는 정보들이 귀찮아서 기억저장용으로 작성해둔다.</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);">괜히 다른것들 이것저것 따라했다가 오류만 계속나고 고생만 죽어라했기에.... 그냥 PyQt5 쓸거면 이렇게 하시라</div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div><div style="margin:0px;padding:0px;font-size:13px;border:0px;vertical-align:baseline;color:rgb(31,31,31);font-family:'맑은 고딕', 'malgun gothic', '돋움', dotum, AppleGothic, sans-serif;background-color:rgb(255,255,255);"><br /></div>]]></description>
<dc:creator>nuno</dc:creator>
<dc:date>2020-01-16T13:47:20+09:00</dc:date>
</item>


<item>
<title>파이썬 배우기</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=4</link>
<description><![CDATA[<p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);">점프 투 파이썬</p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><a href="https://wikidocs.net/book/1" target="_blank" rel="nofollow noreferrer noopener">https://wikidocs.net/book/1</a> </p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);">파이썬 코딩 도장</p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><a href="https://dojang.io/course/view.php?id=7" target="_blank" rel="nofollow noreferrer noopener">https://dojang.io/course/view.php?id=7</a> <br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);">A byte of Python</p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><a href="https://epsimatt.gitbook.io/byte-of-python/about_python" target="_blank" rel="nofollow noreferrer noopener">https://epsimatt.gitbook.io/byte-of-python/about_python</a> </p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);">파이썬 가상환경 사용하기</p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><a href="https://dojang.io/mod/page/view.php?id=2470" target="_blank" rel="nofollow noreferrer noopener">https://dojang.io/mod/page/view.php?id=2470</a> </p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);">파이썬 GUI - Kivy</p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><a href="https://kivy.org/#home" target="_blank" rel="nofollow noreferrer noopener">https://kivy.org/#home</a> </p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p><p style="color:rgb(51,51,51);font-family:sans-serif;font-size:13px;background-color:rgb(255,255,255);"><br /></p>]]></description>
<dc:creator>최고관리자</dc:creator>
<dc:date>2020-01-14T17:05:53+09:00</dc:date>
</item>


<item>
<title>윈도우 Python3에서 PyQt5, Qt Designer 설치 방법</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=3</link>
<description><![CDATA[<p>윈도우 Python3에서 PyQt5, Qt Designer 설치 방법 [32bit 기준]<br /></p><p><br /></p><p><br /></p><p>Python3에서 PyQt5 설치 방법</p><p>&gt; pip3 install pyqt5</p><p><br /></p><p>Python3에서 Qt Designer 설치 방법</p><p>&gt; pip3 install pyqt5-tools</p><p><br /></p><p>Windows 10 기준 Qt Designer 실행파일 위치</p><p>C:\Users\{사용자}\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pyqt5-tools\designer.exe<br /></p><p><br /></p><p><br /></p><p>----------------------------------------------------------------</p><p><br /></p><p>Windows 10 Anaconda3 기준 실행파일 위치</p><p><br /></p><p>C:\Users\{사용자}\Anaconda3\Library\bin\designer.exe<br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><div><br /></div>]]></description>
<dc:creator>nuno</dc:creator>
<dc:date>2018-01-05T10:05:41+09:00</dc:date>
</item>


<item>
<title>Urllib 을 이용한 로그인 및 세션 유지하기</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=2</link>
<description><![CDATA[<p style="background-color:rgb(255,255,255);"><span style="font-family:Gulim, '굴림', AppleGothic, sans-serif;font-size:10pt;">[출처] </span><font face="Gulim, 굴림, AppleGothic, sans-serif"><span style="font-size:13.3333px;line-height:20px;"><a href="http://2thet0p.tistory.com/42" rel="nofollow">http://2thet0p.tistory.com/42</a></span></font></p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;"> </span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;">파이썬을 이용하여</span><span style="font-family:Gulim, '굴림', AppleGothic, sans-serif;font-size:10pt;line-height:20px;">특정 홈페이지에 로그인 후 세션(쿠키)을 유지하면서 다른 페이지를 요청하는 소스</span></p><pre class="brush:py" style="background-color:rgb(255,255,255);">import urllib
import urllib2

url = "http://www.suninatas.com/member/mem_action.asp"
login_form={"Hid":"아이디","Hpw":"암호"}
login_req=urllib.urlencode(login_form)
request=urllib2.Request(url,login_req)
response = urllib2.urlopen(request)
cookie = response.headers.get('Set-Cookie')

data = response.read()

print cookie


url2 = "http://suninatas.com/main/auth_check.asp"
request2 = urllib2.Request(url2)
request2.add_header('cookie',cookie)
response2 = urllib2.urlopen(request2)

data2 = response2.read()

print data2
</pre><p style="font-family:gulim;background-color:rgb(255,255,255);"> </p><p style="font-family:gulim;background-color:rgb(255,255,255);"><br /><span style="width:1px;height:1px;float:right;"></span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"> </p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-family:Gulim, '굴림', AppleGothic, sans-serif;font-size:10pt;">우리 써니나타스 홈페이지를 시험 삼아 코딩을 해보았다</span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"> </p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;">잘 봐야 될 부분은</span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"> </p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;"><span style="color:rgb(9,0,255);"><b>urlencode / headers.get('Set-Cookie') / add_header('cookie', 쿠키값)</b></span> 부분이다.</span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;"> </span></p><p style="font-family:gulim;background-color:rgb(255,255,255);"><font face="Gulim, 굴림, AppleGothic, sans-serif" size="2"><span style="line-height:20px;">이 소스를 잘 활용하면 sql blind injection 공격 시 값을 쉽게 뽑아 낼 수 있다.(추후 포스팅)</span></font></p><p style="font-family:gulim;background-color:rgb(255,255,255);"> </p><p style="font-family:gulim;background-color:rgb(255,255,255);"><span style="font-size:10pt;font-family:Gulim, '굴림', AppleGothic, sans-serif;">참고로.. cookiejar 를 이용한 방법도 있지만 내가 원하는 기능은 이 걸로도 충분하다.</span></p>]]></description>
<dc:creator>nuno</dc:creator>
<dc:date>2016-05-04T13:23:07+09:00</dc:date>
</item>


<item>
<title>실시간 미세먼지농도 Open Api 자료 받아와 저장하기, 받아온 자료 그래프로 그리기</title>
<link>http://nuno21.net/bbs/board.php?bo_table=python&amp;amp;wr_id=1</link>
<description><![CDATA[<p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">텍스트 파일로 자료 저장하기.</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">=======================</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"># -*- coding: cp949 -*-</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import urllib2</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import os</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import time as tm</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import numpy as np</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import matplotlib.dates as date</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import datetime</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import sys</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">gap=input("몇초 동안의 자료를 수집할까요?")</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">lines=np.empty((gap,3))</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">for i in range(0,gap):</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    url="<a href="http://openapi.seoul.go.kr:8088/****/json/ListAvgOfSeoulAirQualityService/1/5" target="_blank" class="con_link" style="text-decoration:none;" rel="nofollow noreferrer noopener">http://openapi.seoul.go.kr:8088/****/json/ListAvgOfSeoulAirQualityService/1/5</a>";</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    data=urllib2.urlopen(url).read();</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    stp=data.find("PM10")+6;</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    edp=data.find("PM25")-2;</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    asctime=str(tm.asctime())</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    asctime=asctime[4:24]</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    if asctime[0:3]=='Sep':</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        asctim<span style="line-height:1.5;">e=asctime.replace('Sep','9')</span></p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    asctime=asctime.replace(':','')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    asctime=asctime.replace(' ','')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    asctime=int(asctime)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    lines[i][0]=asctime</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    lines[i][1]=tm.time()</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    lines[i][2]=float(data[stp:edp])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    loading=gap-i</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    print loading</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    tm.sleep(1)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">            </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">dts=map(datetime.datetime.fromtimestamp,lines[:,1])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">fds=date.date2num(dts)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">lines[:,1]=fds</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename0=str(lines[0][0])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename0=filename0.replace('.','')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename0=filename0[:9]</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename1=str(lines[gap-1][0])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename1=filename1.replace('.','')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filename1=filename1[:9]</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">nlocaltime=str(tm.localtime())</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">ystp=nlocaltime.find('tm_year')+8</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">yedp=ystp+4</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">nyear=str(nlocaltime[ystp:yedp])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">mstp=nlocaltime.find('tm_mon')+7</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">medp=nlocaltime.find(', tm_mday')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">nmon=str(nlocaltime[mstp:medp])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">dstp=nlocaltime.find('tm_mday')+8</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">dedp=nlocaltime.find(', tm_hour')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">nday=str(nlocaltime[dstp:dedp])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">if os.path.exists(nyear+nmon+nday):</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    os.chdir(nyear+nmon+nday)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">else:</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    os.mkdir(nyear+nmon+nday);</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    os.chdir(nyear+nmon+nday)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">np.savetxt(filename0+' to '+filename1+'.txt',lines,header='asctime(m,d,h,m,s,y),date2num,pm10(microgram/cubic meter)')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">os.chdir(os.path.dirname(os.getcwd()))</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">print filename0+' to '+filename1+'.txt 로 저장되었습니다.'</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">========================= </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">텍스트 파일로 자료 저장하기 끝.</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">=========================</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">자료를 바탕으로 그래프 그리기.</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">=========================</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"># -*- coding: cp949 -*-</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import os</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import numpy as np</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import matplotlib.pyplot as plt</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import matplotlib.dates as date</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">import glob as gb</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">getdate=str(input("원하는 자료의 년도,월,일 을 기호 없이 입력해 주십시오."))</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">os.chdir(getdate)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">filelist=gb.glob('*.txt')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">hfmt = date.DateFormatter('%m/%d %H:%M:%S')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);"> </p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">for i in range(0,len(filelist)):</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    check=raw_input(filelist[i]+"을 그릴 까요?(y/n)")</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    if check == 'y':</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        numtime,pm10=np.loadtxt(filelist[i],unpack=True,skiprows=1,usecols=[1,2])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        fig=plt.figure(i)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        ax=fig.add_subplot(111)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        ax.xaxis.set_major_locator(date.AutoDateLocator())</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        ax.xaxis.set_major_formatter(hfmt)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.plot(numtime,pm10)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.xticks(rotation='vertical')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.subplots_adjust(bottom=.3)</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.xlabel('Time')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.ylabel('$\mu$g/m^3')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.title(filelist[i])</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        figname=filelist[i]</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        figname=figname[:-4]</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        if os.path.exists('fig'):</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">            os.chdir('fig')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        else:</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">            os.mkdir('fig');</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">            os.chdir('fig')</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        plt.savefig(figname+".png")</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        os.chdir(os.path.dirname(os.getcwd()))</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        print figname+'.png 로 저장되었습니다.'</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">    else:</p><p style="color:rgb(138,131,126);font-family:'7367_9';text-align:justify;background-color:rgb(255,255,255);">        pass</p><p> </p><p> </p><p> </p><div class="autosourcing-stub-extra" style="line-height:1.5;"><p style="margin:11px 0px 7px;padding:0px;line-height:1.5;font-size:12px;font-family:Dotum;font-style:normal;font-weight:normal;"><strong style="padding:0px 7px 0px 0px;">[출처]</strong> <a href="http://blog.naver.com/pos99008/220132743057" target="_blank" style="text-decoration:none;" rel="nofollow noreferrer noopener">실시간 미세먼지농도 Open Api 자료 받아와 저장하기, 받아온 자료 그래프로 그리기.</a><span style="padding:0px 7px 0px 5px;">|</span><strong style="padding:0px 7px 0px 0px;">작성자</strong> <a href="http://blog.naver.com/pos99008" target="_blank" style="text-decoration:none;" rel="nofollow noreferrer noopener">plz</a></p></div>]]></description>
<dc:creator>최고관리자</dc:creator>
<dc:date>2016-04-04T13:12:01+09:00</dc:date>
</item>

</channel>
</rss>
