<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>파이썬패키징 보관 - 하우인포-IT·테크</title>
	<atom:link href="https://howinfo.kr/tag/%ed%8c%8c%ec%9d%b4%ec%8d%ac%ed%8c%a8%ed%82%a4%ec%a7%95/feed/" rel="self" type="application/rss+xml" />
	<link>https://howinfo.kr/tag/파이썬패키징/</link>
	<description>IT·AI 자동화 &#38; 인프라 전문 블로그 (하우인포)</description>
	<lastBuildDate>Sat, 28 Feb 2026 00:28:24 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://howinfo.kr/wp-content/uploads/2026/02/cropped-ChatGPT-Image-2026년-2월-12일-오후-05_39_40-32x32.png</url>
	<title>파이썬패키징 보관 - 하우인포-IT·테크</title>
	<link>https://howinfo.kr/tag/파이썬패키징/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>파이썬 프로그램을 윈도우 EXE로 만드는 방법 (PyInstaller 실전 가이드)</title>
		<link>https://howinfo.kr/%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%a8%ec%9d%84-%ec%9c%88%eb%8f%84%ec%9a%b0-exe%eb%a1%9c-%eb%a7%8c%eb%93%9c%eb%8a%94-%eb%b0%a9%eb%b2%95-pyinstaller-%ec%8b%a4%ec%a0%84/</link>
					<comments>https://howinfo.kr/%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%a8%ec%9d%84-%ec%9c%88%eb%8f%84%ec%9a%b0-exe%eb%a1%9c-%eb%a7%8c%eb%93%9c%eb%8a%94-%eb%b0%a9%eb%b2%95-pyinstaller-%ec%8b%a4%ec%a0%84/#respond</comments>
		
		<dc:creator><![CDATA[hong]]></dc:creator>
		<pubDate>Sat, 28 Feb 2026 00:28:23 +0000</pubDate>
				<category><![CDATA[IT기초]]></category>
		<category><![CDATA[exe배포]]></category>
		<category><![CDATA[Pyinstaller]]></category>
		<category><![CDATA[tkinter]]></category>
		<category><![CDATA[개발팁]]></category>
		<category><![CDATA[배포자동화]]></category>
		<category><![CDATA[빌드]]></category>
		<category><![CDATA[윈도우exe]]></category>
		<category><![CDATA[파이썬]]></category>
		<category><![CDATA[파이썬패키징]]></category>
		<category><![CDATA[프로그램 배포]]></category>
		<guid isPermaLink="false">https://howinfo.kr/?p=2108</guid>

					<description><![CDATA[<p>파이썬으로 만든 스크립트가 잘 돌아가도, 주변 사람에게 공유하려면 항상 이런 문제가 생깁니다. 그래서 결국 많이 선택하는 방법이 EXE로 패키징하는 겁니다.이번...</p>
<p>게시물 <a href="https://howinfo.kr/%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%a8%ec%9d%84-%ec%9c%88%eb%8f%84%ec%9a%b0-exe%eb%a1%9c-%eb%a7%8c%eb%93%9c%eb%8a%94-%eb%b0%a9%eb%b2%95-pyinstaller-%ec%8b%a4%ec%a0%84/">파이썬 프로그램을 윈도우 EXE로 만드는 방법 (PyInstaller 실전 가이드)</a>이 <a href="https://howinfo.kr">하우인포-IT·테크</a>에 처음 등장했습니다.</p>
]]></description>
										<content:encoded><![CDATA[
<p>파이썬으로 만든 스크립트가 잘 돌아가도, 주변 사람에게 공유하려면 항상 이런 문제가 생깁니다.</p>



<ul class="wp-block-list">
<li>“파이썬 설치해야 해?”</li>



<li>“pip로 뭐 설치해야 해?”</li>



<li>“실행했더니 검은 창만 뜨고 꺼지는데?”</li>
</ul>



<p>그래서 결국 많이 선택하는 방법이 <strong>EXE로 패키징</strong>하는 겁니다.<br>이번 글은 제가 실제로 가장 많이 쓰는 도구인 <strong>PyInstaller</strong> 기준으로, “초보도 따라 할 수 있게” 정리했습니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">1) EXE 만들기 전에 꼭 알아야 할 것</h2>



<h3 class="wp-block-heading">✅ EXE로 만들면 좋은 점</h3>



<ul class="wp-block-list">
<li>파이썬이 설치되지 않은 PC에서도 실행 가능(대부분의 경우)</li>



<li>배포/공유가 편해짐</li>



<li>파일 1개(또는 폴더 1개)로 정리 가능</li>
</ul>



<h3 class="wp-block-heading">⚠️ 현실적으로 생기는 문제</h3>



<ul class="wp-block-list">
<li>용량이 커짐(수십~수백 MB도 흔함)</li>



<li>백신 오탐(특히 새로 만든 exe)</li>



<li>경로 문제(파일 저장/설정 파일 위치)</li>



<li>GUI(Tkinter 등)에서는 괜찮은데, 콘솔 출력은 안 보이기도 함</li>
</ul>



<p>이걸 미리 알고 가면 삽질이 크게 줄어요.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">2) 준비물: 파이썬/폴더 구조 추천</h2>



<h3 class="wp-block-heading">권장 폴더 구조 예시</h3>



<pre class="wp-block-preformatted">my_app/<br>  main.py<br>  core/<br>  assets/<br>  data/<br>  requirements.txt</pre>



<ul class="wp-block-list">
<li><strong>assets/</strong> : 이미지, 아이콘 등 리소스</li>



<li><strong>data/</strong> : 설정 파일, 저장 파일(앱 실행 중 생성되는 데이터)</li>



<li><strong>requirements.txt</strong> : 의존성 목록</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">3) PyInstaller 설치</h2>



<p>가장 먼저 <strong>가상환경</strong>을 추천합니다. (빌드가 깔끔해져요)</p>



<h3 class="wp-block-heading">(선택) 가상환경 만들기</h3>



<pre class="wp-block-preformatted">cd my_app<br>python -m venv .venv<br>.venv\Scripts\activate</pre>



<h3 class="wp-block-heading">PyInstaller 설치</h3>



<pre class="wp-block-preformatted">python -m pip install --upgrade pip<br>pip install pyinstaller</pre>



<p>설치 확인:</p>



<pre class="wp-block-preformatted">pyinstaller --version</pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">4) 가장 기본 빌드: onefile로 EXE 만들기</h2>



<h3 class="wp-block-heading">콘솔 프로그램(터미널 창 필요)</h3>



<pre class="wp-block-preformatted">pyinstaller --onefile main.py</pre>



<h3 class="wp-block-heading">GUI 프로그램(창만 띄우고 콘솔 숨김)</h3>



<pre class="wp-block-preformatted">pyinstaller --onefile --noconsole main.py</pre>



<p>빌드가 끝나면 보통 아래 폴더가 생깁니다.</p>



<ul class="wp-block-list">
<li><code>dist/</code> : 실제 배포 파일(exe)</li>



<li><code>build/</code> : 빌드 캐시</li>



<li><code>main.spec</code> : 빌드 설정 파일</li>
</ul>



<p>결과 EXE는 <code>dist/main.exe</code> 에서 확인합니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">5) 아이콘 넣기(윈도우 exe 느낌 살리기)</h2>



<p>아이콘은 <code>.ico</code> 파일이 필요합니다. (png 그대로는 안됨)</p>



<pre class="wp-block-preformatted">pyinstaller --onefile --noconsole --icon=assets/app.ico main.py</pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">6) 이미지/설정파일 등 “외부 파일” 포함하기</h2>



<p>여기서 많이 막힙니다.<br>파이썬에서는 상대경로로 잘 읽히는데, exe로 묶이면 경로가 달라져요.</p>



<h3 class="wp-block-heading">6-1) 빌드 옵션으로 파일 포함</h3>



<p>예: <code>assets/</code> 폴더를 함께 포함</p>



<pre class="wp-block-preformatted">pyinstaller --onefile --noconsole ^<br>  --add-data "assets;assets" ^<br>  main.py</pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>윈도우에서 <code>--add-data "원본;대상"</code> 형태로 세미콜론(<code>;</code>)을 사용합니다.</p>
</blockquote>



<h3 class="wp-block-heading">6-2) exe 환경에서 경로 처리(핵심)</h3>



<p>파이썬 코드에서 “실행 위치”를 잡는 함수를 넣어두면 안정적입니다.</p>



<pre class="wp-block-preformatted">import os, sysdef resource_path(relative_path: str) -&gt; str:<br>    # PyInstaller로 묶이면 _MEIPASS 경로에 리소스가 풀림<br>    base_path = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))<br>    return os.path.join(base_path, relative_path)</pre>



<p>사용 예:</p>



<pre class="wp-block-preformatted">icon_path = resource_path("assets/app.ico")</pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">7) “exe 실행하면 저장이 안돼요/초기화돼요” 문제 해결</h2>



<p>이 현상은 거의 대부분 <strong>저장 위치가 잘못 잡혀서</strong> 생깁니다.</p>



<ul class="wp-block-list">
<li>개발 중: 프로젝트 폴더에 저장</li>



<li>exe 실행: 사용자 PC의 다른 위치에서 실행 → 상대경로가 달라짐</li>



<li>또는 Program Files 아래라면 쓰기 권한 문제로 저장 실패</li>
</ul>



<h3 class="wp-block-heading">추천: 사용자 폴더(AppData) 아래에 저장 폴더 만들기</h3>



<pre class="wp-block-preformatted">import osdef get_app_data_dir(app_name="MyApp"):<br>    base = os.getenv("APPDATA")  # C:\Users\...\AppData\Roaming<br>    path = os.path.join(base, app_name)<br>    os.makedirs(path, exist_ok=True)<br>    return path</pre>



<p>저장 예:</p>



<pre class="wp-block-preformatted">cfg_path = os.path.join(get_app_data_dir("HStockGuard"), "config.json")</pre>



<p>이렇게 하면 exe로 배포해도 <strong>설정/저장 데이터가 유지</strong>됩니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">8) 자주 겪는 에러/해결 체크리스트</h2>



<h3 class="wp-block-heading">✅ 실행하자마자 창이 꺼짐</h3>



<ul class="wp-block-list">
<li>콘솔 모드로 빌드해서 에러 확인<br><code>--noconsole</code> 빼고 실행해보기</li>
</ul>



<h3 class="wp-block-heading">✅ 모듈 못 찾는다고 나옴</h3>



<ul class="wp-block-list">
<li>누락된 모듈을 hidden-import로 추가</li>
</ul>



<pre class="wp-block-preformatted">pyinstaller --onefile --hidden-import=패키지명 main.py</pre>



<h3 class="wp-block-heading">✅ 백신이 위험하다고 막음</h3>



<ul class="wp-block-list">
<li>새 exe는 오탐이 흔함</li>



<li>코드서명까지는 현실적으로 어렵고, 최소한 배포 파일을 자주 바꾸지 않는 게 도움</li>



<li>가능하면 <code>onedir</code> 배포도 고려(오탐이 덜 나는 경우가 있음)</li>
</ul>



<h3 class="wp-block-heading">✅ 용량이 너무 큼</h3>



<ul class="wp-block-list">
<li>가상환경을 깨끗하게 유지</li>



<li>불필요한 패키지 제거</li>



<li><code>--exclude-module</code> 사용 고려(상황에 따라)</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">9) 배포 방식 추천: onefile vs onedir</h2>



<h3 class="wp-block-heading">onefile</h3>



<ul class="wp-block-list">
<li>장점: 파일 1개로 배포 끝</li>



<li>단점: 실행 시 임시폴더에 풀리는 과정 때문에 첫 실행이 느릴 수 있음</li>
</ul>



<h3 class="wp-block-heading">onedir</h3>



<pre class="wp-block-preformatted">pyinstaller --noconsole main.py</pre>



<ul class="wp-block-list">
<li>장점: 실행 빠르고 문제 추적이 쉬움</li>



<li>단점: 폴더째로 배포해야 함</li>
</ul>



<p>개인적으로는 <strong>처음엔 onedir로 안정화 → 마지막에 onefile</strong>로 마무리하는 경우가 많았습니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">FAQ</h2>



<p><strong>Q1. PyInstaller 말고 다른 방법도 있나요?</strong><br>A. 네. <code>cx_Freeze</code>, <code>Nuitka</code> 같은 대안도 있습니다. 다만 가장 대중적이고 자료가 많은 건 PyInstaller입니다.</p>



<p><strong>Q2. 32비트/64비트는 어떻게 맞추나요?</strong><br>A. 빌드에 사용하는 파이썬이 64비트면 보통 64비트 exe가 됩니다. 배포 대상 PC 환경과 맞추세요.</p>



<p><strong>Q3. exe로 만들면 소스가 완전히 숨겨지나요?</strong><br>A. 완전한 보안은 아닙니다. “배포 편의” 목적에 가깝다고 보는 게 현실적입니다.</p>



<h1 class="wp-block-heading">부록) 그대로 복사해서 쓰는 샘플 코드(저장 유지 + 리소스 경로)</h1>



<h2 class="wp-block-heading">core/paths.py</h2>



<pre class="wp-block-preformatted">import os<br>import sysdef resource_path(relative_path: str) -&gt; str:<br>    """<br>    PyInstaller(onefile)에서 리소스 경로를 안전하게 가져온다.<br>    """<br>    base_path = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))<br>    return os.path.join(base_path, relative_path)def appdata_dir(app_name: str = "MyApp") -&gt; str:<br>    """<br>    AppData\Roaming 아래에 앱 폴더를 생성해 저장 경로로 사용한다.<br>    """<br>    base = os.getenv("APPDATA") or os.path.expanduser("~")<br>    path = os.path.join(base, app_name)<br>    os.makedirs(path, exist_ok=True)<br>    return path</pre>



<h2 class="wp-block-heading">core/config.py</h2>



<pre class="wp-block-preformatted">import json<br>import os<br>from .paths import appdata_dirdef load_config(app_name: str = "MyApp", filename: str = "config.json") -&gt; dict:<br>    path = os.path.join(appdata_dir(app_name), filename)<br>    if not os.path.exists(path):<br>        return {}<br>    with open(path, "r", encoding="utf-8") as f:<br>        return json.load(f)def save_config(cfg: dict, app_name: str = "MyApp", filename: str = "config.json") -&gt; str:<br>    path = os.path.join(appdata_dir(app_name), filename)<br>    with open(path, "w", encoding="utf-8") as f:<br>        json.dump(cfg, f, ensure_ascii=False, indent=2)<br>    return path</pre>



<h2 class="wp-block-heading">main.py (테스트용)</h2>



<pre class="wp-block-preformatted">from core.config import load_config, save_configAPP_NAME = "HowinfoPyExeDemo"def main():<br>    cfg = load_config(APP_NAME)<br>    run_count = int(cfg.get("run_count", 0)) + 1<br>    cfg["run_count"] = run_count    saved_path = save_config(cfg, APP_NAME)<br>    print(f"[OK] 실행 횟수: {run_count}")<br>    print(f"[OK] 설정 저장 위치: {saved_path}")if __name__ == "__main__":<br>    main()</pre>



<h2 class="wp-block-heading">빌드 명령어(윈도우)</h2>



<pre class="wp-block-preformatted">pyinstaller --onefile main.py</pre>



<p>GUI + 아이콘 + assets 포함 예시:</p>



<pre class="wp-block-preformatted">pyinstaller --onefile --noconsole ^<br>  --icon=assets/app.ico ^<br>  --add-data "assets;assets" ^<br>  main.py<br></pre>
<p>게시물 <a href="https://howinfo.kr/%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%a8%ec%9d%84-%ec%9c%88%eb%8f%84%ec%9a%b0-exe%eb%a1%9c-%eb%a7%8c%eb%93%9c%eb%8a%94-%eb%b0%a9%eb%b2%95-pyinstaller-%ec%8b%a4%ec%a0%84/">파이썬 프로그램을 윈도우 EXE로 만드는 방법 (PyInstaller 실전 가이드)</a>이 <a href="https://howinfo.kr">하우인포-IT·테크</a>에 처음 등장했습니다.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://howinfo.kr/%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%a8%ec%9d%84-%ec%9c%88%eb%8f%84%ec%9a%b0-exe%eb%a1%9c-%eb%a7%8c%eb%93%9c%eb%8a%94-%eb%b0%a9%eb%b2%95-pyinstaller-%ec%8b%a4%ec%a0%84/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
