{"id":21321,"date":"2023-06-12T23:32:20","date_gmt":"2023-06-12T14:32:20","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=21321"},"modified":"2023-06-17T11:51:20","modified_gmt":"2023-06-17T02:51:20","slug":"%e3%80%90python%e3%80%91python%e3%81%ae%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92exe%e5%8c%96%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=21321","title":{"rendered":"\u3010Python\u3011pyinstaller\u3067Python\u306e\u30b3\u30fc\u30c9\u3092exe\u5316\u3059\u308b\u3002"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">pyinstaller\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>Python\u30b3\u30fc\u30c9\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5168\u3066\u4e00\u3064\u306e\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb(exe)\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u901a\u5e38\u306ePython\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3068Python\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u74b0\u5883\u3067\u3057\u304b\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u3057\u304b\u3057\u3001exe\u5316\u3059\u308b\u3053\u3068\u3067Python\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u306a\u7b2c\u4e09\u8005\u306e\u74b0\u5883\u3067\u3082\u52d5\u304b\u3059\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Python\u3060\u3051\u3067\u306a\u304f\u3001\u5834\u5408\u306b\u3088\u3063\u3066\u306f\u4f5c\u6210\u3057\u305fPython\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u4f7f\u3063\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u306a\u3069\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3082\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3057\u3001\u4eee\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3082\u3089\u3048\u308b\u3068\u3057\u3066\u3082\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3067\u60f3\u5b9a\u3057\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u7570\u306a\u3063\u3066\u3044\u305f\u3089\u52d5\u304b\u306a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u524d\u63d0\u6761\u4ef6\u3001\u6ce8\u610f\u70b9<\/h2>\n\n\n\n<ul>\n<li>Python3.6\u4ee5\u4e0a\u3067\u3042\u308b\u3053\u3068<\/li>\n\n\n\n<li>Windows\u3067\u4f5c\u3063\u305f\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306fWindows\u3067\u3057\u304b\u52d5\u304b\u306a\u3044\u3067\u3059\u3057\u3001Mac\u3067\u4f5c\u3063\u305f\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306fMac\u3067\u3057\u304b\u52d5\u304b\u306a\u3044\u3067\u3059\u3002<\/li>\n\n\n\n<li>64bitOS\u3067\u4f5c\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u306f32bitOS\u3067\u306f\u52d5\u304b\u306a\u3044\u3002\u9006\u306b32bitOS\u3067\u4f5c\u3063\u305f\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306f64\u30d3\u30c3\u30c8OS\u3067\u4f7f\u3048\u307e\u3059\u3002\uff08\u4e0a\u4f4d\u4e92\u63db\u6027\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u4e0b\u4f4d\u4e92\u63db\u6027\u306f\u3042\u308a\u307e\u3059\u3002\uff09<\/li>\n\n\n\n<li>\u516c\u5f0f\u30b5\u30a4\u30c8(https:\/\/pyinstaller.org\/en\/stable\/)\u306b\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u4e00\u89a7\u306f\u3042\u308b\u304c\u3001\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u304f\u3066\u3082\u57fa\u672c\u306f\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u306f\u53ef\u80fd\u3067\u3059\u3002<\/li>\n\n\n\n<li>Mac\u306e\u5834\u5408\u306f\u4ed6\u306e\u30de\u30b7\u30f3\u3067\u4f5c\u3063\u305fexe\u3092\u5b9f\u884c\u3059\u308b\u5834\u5408\u306f\u8b66\u544a\u304c\u51fa\u307e\u3059\u3002\uff08\u300c\u30b7\u30b9\u30c6\u30e0\u74b0\u5883\u8a2d\u5b9a\u300d\u2192\u300c\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u30d7\u30e9\u30a4\u30d0\u30b7\u30fc\u300d\u306b\u3066\u8a2d\u5b9a\u89e3\u9664\u3057\u3066\u3042\u3052\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\uff09<\/li>\n\n\n\n<li>\u5916\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u5834\u5408\u306f\u4e00\u6c17\u306b\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\uff08\u4f8b\u3048\u3070Pandas\u306a\u3069\uff09<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install pyinstaller<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3064\u306e\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u308b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Windows\u306e\u5834\u5408<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>pyinstaller Python\u30b9\u30af\u30ea\u30d7\u30c8\u540d --onefile<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3064\u3068\u6253\u3063\u305f\u5834\u6240\u3068\u540c\u968e\u5c64\u306b\u300cdist\u300d\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u304c\u751f\u6210\u3055\u308c\u3066\u305d\u306e\u4e2d\u306bexe\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import time\n\nprint('Hello World')\n\ntime.sleep(20)<\/code><\/pre>\n\n\n\n<p>\u8a66\u3057\u306b\u4e0a\u8a18\u306esample.py\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307e\u3068\u3081\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pyinstaller sample.py --onefile<\/code><\/pre>\n\n\n\n<p>dist\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b\u300csample.exe\u300d\u3068\u3044\u3046\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u308b\u306e\u3067\u8d77\u52d5\u3059\u308b\u3068\u3044\u304b\u306e\u3088\u3046\u306b\u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u30a6\u30a4\u30f3\u30c9\u30a6\u304c\u8868\u793a\u3055\u308c\u306620\u79d2\u9593\u8d77\u52d5\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"573\" height=\"152\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2023\/06\/image-35.png\" alt=\"\" class=\"wp-image-21491\" srcset=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2023\/06\/image-35.png 573w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2023\/06\/image-35-300x80.png 300w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u5404\u7a2e\u30aa\u30d7\u30b7\u30e7\u30f3<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">--noconsole<\/h3>\n\n\n\n<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3060\u3063\u305f\u3089\u554f\u984c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306a\u3069\u3092\u4f5c\u3063\u305f\u5834\u5408\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u306f\u898b\u305b\u305f\u304f\u306a\u3044\u306e\u3067\u305d\u3046\u3044\u3063\u305f\u5834\u5408\u306b\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">--icon=\u30a2\u30a4\u30b3\u30f3\u540d.ico<\/h3>\n\n\n\n<p>exe\u306e\u30a2\u30a4\u30b3\u30f3\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u5834\u5408\u306b\u4f7f\u3048\u307e\u3059\u3002\u30a2\u30a4\u30b3\u30f3\u306f\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092icon\u306b\u5909\u63db\u3059\u308b\u30b5\u30a4\u30c8\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u305d\u308c\u3067\u751f\u6210\u3059\u308b\u3068\u3088\u3044\u3067\u3057\u3087\u3046\u3002\u3061\u306a\u307f\u306bfavicon\u753b\u50cf\u306b\u3082\u3044\u304f\u3064\u304b\u30b5\u30a4\u30ba\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u30b5\u30a4\u30ba\u3060\u3068\u3046\u307e\u304f\u8868\u793a\u3055\u308c\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30d5\u30a1\u30a4\u30eb\u540d.spec<\/h2>\n\n\n\n<p>python\u30d5\u30a1\u30a4\u30eb\u3068\u540c\u3058\u968e\u5c64\u306bspec\u3068\u4ed8\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306fpython\u3092\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002python\u30b3\u30fc\u30c9\u4ee5\u5916\u306e\u3082\u306e\u3092exe\u306b\u57cb\u3081\u8fbc\u307f\u305f\u3044\u5834\u5408\u306b\u7de8\u96c6\u3057\u305f\u308a\u3057\u307e\u3059\u3002\uff08\u4f8b\u3048\u3070\u3001Python\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067\u753b\u50cf\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3053\u3053\u306b\u8a2d\u5b9a\u3057\u306a\u3044\u3068\u57cb\u3081\u8fbc\u3081\u307e\u305b\u3093\u3002\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"pyinstaller\u3068\u306f\uff1f Python\u30b3\u30fc\u30c9\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5168\u3066\u4e00\u3064\u306e\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb(exe)\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u901a\u5e38\u306ePython\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060\u3068Python\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u74b0\u5883\u3067\u3057\u304b\u52d5\u4f5c\u3055 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[47,1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/21321"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21321"}],"version-history":[{"count":11,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/21321\/revisions"}],"predecessor-version":[{"id":21499,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/21321\/revisions\/21499"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21321"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}