{"id":92,"date":"2012-03-07T17:32:07","date_gmt":"2012-03-07T09:32:07","guid":{"rendered":"http:\/\/www.freezhongzi.info\/?p=92"},"modified":"2012-03-07T17:32:07","modified_gmt":"2012-03-07T09:32:07","slug":"%e4%bd%bf%e7%94%a8py2exe%e8%bd%ac%e6%8d%a2python%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/bl4kraven.com\/index.php\/2012\/03\/07\/%e4%bd%bf%e7%94%a8py2exe%e8%bd%ac%e6%8d%a2python%e8%84%9a%e6%9c%ac\/","title":{"rendered":"\u4f7f\u7528py2exe\u8f6c\u6362Python\u811a\u672c"},"content":{"rendered":"<p>\u6700\u8fd1\u6211\u7528C++\u5199\u7684\u7a0b\u5e8f\u9700\u8981\u8c03\u7528\u4e00\u4e2aPython\u811a\u672c\uff0c\u4e4b\u524d\u770b\u8fc7\u8fd9\u65b9\u9762\u8d44\u6599\u65e0\u975e\u5c31\u662f\u8c03\u7528Python\u7684C API\uff0c\u6211\u8fd8\u4e13\u95e8\u7814\u7a76\u4e86\u4e00\u756aPython\u7684C++\u5305\u88c5\u5e93<a href=\"http:\/\/cxx.sourceforge.net\/\">Pycxx<\/a>\uff0c\u4f46\u90fd\u65e0\u529f\u800c\u8fd4\uff0c\u6ca1\u529e\u6cd5\u53ea\u80fd\u8001\u8001\u5b9e\u5b9e\u7684\u7528py2exe\u6253\u5305\u4e86:)\u3002 \u4e0a<a href=\"http:\/\/www.py2exe.org\">py2exe\u5b98\u7f51<\/a>\u770b\u4e86\u4f1a\u6559\u7a0b\uff0c\u6211\u53d1\u73b0\u8fd8\u7b97\u7b80\u5355\uff0c\u9a6c\u4e0a\u52a8\u624b\u5199\u4e86\u4e2asetup.py\uff1a<br \/>\n    # py2exe convert python script to exe<br \/>\n    from distutils.core import setup<br \/>\n    import py2exe<\/p>\n<pre><code>setup(\n        console=[\"AutoUpdate.py\"],\n        data_files=[\n            (\".\", [\"C:\\Python27\\msvcr90.dll\", \"C:\\Python27\\Microsoft.VC90.CRT.manifest\"])\n            ],\n        #zipfile=\"library.zip\",\n        options={\n            \"py2exe\":{\n                \"unbuffered\":True,\n                \"optimize\":2,\n                \"compressed\":True,\n                \"bundle_files\":2,\n                \"dist_dir\":\"..\\\"\n                }\n            }\n        )\n \u5176\u4e2dsetup\u51fd\u6570\u7684options\u7684py2exe\u7684bundle_files\u53c2\u6570\uff08\u5f88\u62d7\u53e3\u554a\uff09\u6709\u4e09\u4e2a\u503c\uff1a \n<\/code><\/pre>\n<ul>\n<li>1 = \u6240\u6709\u6a21\u5757\u90fd\u6253\u5305\u8fdbexe\uff0c\u6700\u7ec8\u751f\u6210\u5355\u72ec\u7684exe\u6587\u4ef6(\u9700\u8981\u8bbe\u7f6ezipfile=None)<\/li>\n<li>2 = \u9664python27.dll\u5916\u6a21\u5757\u90fd\u6253\u5305\u8fdbexe\u6587\u4ef6<\/li>\n<li>3 = \u6a21\u5757\u90fd\u4e0d\u6253\u5305\u8fdbexe\uff0c\u4f1a\u751f\u6210\u5f88\u591a\u6587\u4ef6\uff0c\u8fd9\u662f\u9ed8\u8ba4 \u5982\u679c\u4f60\u6709\u6d01\u7656\uff0c\u4e0d\u559c\u6b22\u4e71\u7cdf\u7cdf\u7684\u6587\u4ef6\u7684\u8bdd\u53ef\u4ee5\u8003\u8651\u628abundle_files\u8bbe\u7f6e\u62101\u3002 \u8fd8\u6709\u4e00\u4e2a\u95ee\u9898\u662f<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.programlife.net\/python26-py2exe-error.html\">\u4f9d\u8d56VC\u52a8\u6001\u5e93\u95ee\u9898<\/a>\uff0c\u5e78\u597d\u5728Python\u5b89\u88c5\u76ee\u5f55\u4e0b\u6709\u3002\u6211\u73b0\u5728\u88c5\u7684\u662fPython2.7.1\uff0c\u5b89\u88c5\u5728C:Python27\u4e0b\uff0c\u91cc\u9762\u6709MSVCR90.DLL(\u7248\u672c\u53f79.0.21022.8)\u548cMicrosoft.VC90.CRT.manifest\u4e24\u4e2a\u6587\u4ef6\u62f7\u5230\u5f53\u524d\u76ee\u5f55\u5c31\u884c\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u6211\u7528C++\u5199\u7684\u7a0b\u5e8f\u9700\u8981\u8c03\u7528\u4e00\u4e2aPython\u811a\u672c\uff0c\u4e4b\u524d\u770b\u8fc7\u8fd9\u65b9\u9762\u8d44\u6599\u65e0\u975e\u5c31\u662f\u8c03 &hellip; <a href=\"https:\/\/bl4kraven.com\/index.php\/2012\/03\/07\/%e4%bd%bf%e7%94%a8py2exe%e8%bd%ac%e6%8d%a2python%e8%84%9a%e6%9c%ac\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a> <a href=\"https:\/\/bl4kraven.com\/index.php\/2012\/03\/07\/%e4%bd%bf%e7%94%a8py2exe%e8%bd%ac%e6%8d%a2python%e8%84%9a%e6%9c%ac\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-program"],"_links":{"self":[{"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":0,"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bl4kraven.com\/index.php\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}