{"id":117,"date":"2015-03-24T03:52:40","date_gmt":"2015-03-24T11:52:40","guid":{"rendered":"https:\/\/www.actinia.me\/?p=117"},"modified":"2016-04-10T17:54:38","modified_gmt":"2016-04-11T01:54:38","slug":"py2exe%e7%9a%84%e4%b8%80%e4%ba%9b%e9%97%ae%e9%a2%98%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.actinia.me\/?p=117","title":{"rendered":"py2exe\u7684\u4e00\u4e9b\u95ee\u9898\u3002"},"content":{"rendered":"<p>\u51e0\u4e2a\u6708\u524d\u7f16\u8bd1\u5b8c\u5168\u6b63\u5e38\u7684\u4e00\u4e2apy\u6587\u4ef6\u6628\u5929\u91cd\u65b0\u7f16\u8bd1\u5c31\u51fa\u4e86\u4e00\u8fde\u4e32\u95ee\u9898\u3002\u5206\u522b\u89e3\u51b3\u5982\u4e0b\u3002<br \/>\n1\u3001\u9996\u5148\u662fRuntimeError: maximum recursion depth exceeded\u5bfc\u81f4\u7f16\u8bd1\u4e2d\u65ad\u3002\u5728STO<span style=\"color: #339966;\"><a style=\"color: #339966;\" title=\"\u63d0\u95ee\" href=\"http:\/\/stackoverflow.com\/questions\/29211840\/maximum-recursion-depth-exceeded-while-compiling-py-file-with-py2exe\">\u63d0\u95ee<\/a><\/span>\u5f97\u5230\u89e3\u51b3\uff1a\u5728setup\u6587\u4ef6\u5f00\u5934\u6dfb\u4e0a\uff1a<br \/>\n<span style=\"color: #993300;\">import sys<\/span><br \/>\n<span style=\"color: #993300;\"> sys.setrecursionlimit(5000)<\/span><br \/>\n\u5373\u53ef\u3002<\/p>\n<p>2.\u867d\u7136\u7f16\u8bd1\u51fa\u4e86exe\uff0c\u4f46\u662f\u5f97\u5230\u7684exe\u8fd0\u884c\u65f6\u62a5\u544a\u7f3a\u5c11\u201c_validation\u201d\u3002\u89e3\u51b3\u529e\u6cd5\u662f\u5728setup\u6587\u4ef6\u4e2d\u5c06validation\u624b\u52a8include\u8fdb\u53bb\uff0c\u50cf\u8fd9\u6837\uff1a<br \/>\n<span style=\"color: #993300;\"># mysetup.py<\/span><br \/>\n<span style=\"color: #993300;\"> import sys<\/span><br \/>\n<span style=\"color: #993300;\"> sys.setrecursionlimit(50000)<\/span><br \/>\n<span style=\"color: #993300;\"> from distutils.core import setup<\/span><br \/>\n<span style=\"color: #993300;\"> import py2exe<\/span><br \/>\n<span style=\"color: #993300;\"> options = {<\/span><br \/>\n<span style=\"color: #993300;\"> &#8220;py2exe&#8221;: {&#8220;compressed&#8221;:1,<\/span><br \/>\n<span style=\"color: #993300;\"> &#8220;optimize&#8221;:2,<\/span><br \/>\n<span style=\"color: #993300;\"> &#8220;includes&#8221;:[&#8220;scipy.sparse.csgraph._validation&#8221;,&#8221;scipy.special._ufuncs_cxx&#8221;,&#8221;sympy.printing.gtk&#8221;],<\/span><br \/>\n<span style=\"color: #993300;\"> &#8220;bundle_files&#8221;:1}<\/span><br \/>\n<span style=\"color: #993300;\"> };<\/span><br \/>\n<span style=\"color: #993300;\"> setup(<\/span><br \/>\n<span style=\"color: #993300;\"> windows = [&#8220;nlk.py&#8221;],<\/span><br \/>\n<span style=\"color: #993300;\"> options = options,<\/span><br \/>\n<span style=\"color: #993300;\"> )<\/span><br \/>\n\u5176\u4e2d\u7684scipy.sparse.csgraph._validation&#8221;,&#8221;scipy.special._ufuncs_cxx&#8221;,&#8221;sympy.printing.gtk\u90fd\u662f\u6839\u636e\u540e\u6765\u7684\u62a5\u9519\u9010\u4e2a\u6dfb\u52a0\u8fdb\u53bb\u7684\u3002\u671f\u95f4\u8fd8\u5b89\u88c5\u4e86gtk\u8fd9\u4e2a\u5305\u3002\u81f3\u4e8e\u8fd9\u662f\u4e2a\u5565\uff1f\u4e0d\u77e5\u9053\u3002<\/p>\n<p>3.\u6700\u540e\u4e00\u4e2a\u95ee\u9898\u662f\u5982\u4e0b\u62a5\u9519\uff1a<br \/>\n<span style=\"color: #993300;\">OMP: Warning #178: Function GetModuleHandleEx failed<\/span><br \/>\n<span style=\"color: #993300;\"> OMP: System error #126: The specified module could not be found.<\/span><br \/>\nSTO\u4e0a\u4e00\u4e2a\u76f8\u5173\u95ee\u9898\u7ed9\u51fa\u7684\u5efa\u8bae\u662f\u53bbsourceforge\u91cd\u65b0\u5b89\u88c5numpy1.8.1\u3002\u8bd5\u4e86\u4f46\u65e0\u6548\u3002\u540e\u6765\u53d1\u73b0\u5c06setup\u6587\u4ef6\u4e2d\u7684bundle_files\u503c\u6539\u4e3a3\u5c31\u6b63\u5e38\u3002\u4f46\u662f\u8fd9\u6837\u5f97\u5230\u7684exe\u5c31\u4e0d\u662f\u5355\u4e00\u6587\u4ef6\u4e86\uff0c\u6709\u70b9\u4e0d\u723d\u3002\u800c\u4e14\u4f53\u79ef\u5947\u5927\uff0c6k\u7684\u811a\u672c\u7f16\u8bd1\u51fa\u6765\u4e00\u4e2a\u8fd1200M\u7684\u6587\u4ef6\u5939\u3002<\/p>\n<p>\u603b\u4e4b\u5462\uff0c\u8fd9\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u7b97\u662f\u6709\u4e86\u3002\u4f18\u5316\u7684\u4e8b\u4ee5\u540e\u518d\u8bf4\u5427\u3002(:\uff13\u3063)\u220b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51e0\u4e2a\u6708\u524d\u7f16\u8bd1\u5b8c\u5168\u6b63\u5e38\u7684\u4e00\u4e2apy\u6587\u4ef6\u6628\u5929\u91cd\u65b0\u7f16\u8bd1\u5c31\u51fa\u4e86\u4e00\u8fde\u4e32\u95ee\u9898\u3002\u5206\u522b\u89e3\u51b3\u5982\u4e0b\u3002 1\u3001\u9996\u5148\u662fRuntimeError: maximum recursion depth exceeded\u5bfc\u81f4\u7f16\u8bd1\u4e2d\u65ad\u3002\u5728STO\u63d0\u95ee\u5f97\u5230\u89e3\u51b3\uff1a\u5728setup\u6587\u4ef6\u5f00\u5934\u6dfb\u4e0a\uff1a import sys sys.setrecursionlimit(5000) \u5373\u53ef\u3002 2.\u867d\u7136\u7f16\u8bd1\u51fa\u4e86exe\uff0c\u4f46\u662f\u5f97\u5230\u7684exe\u8fd0\u884c\u65f6\u62a5\u544a\u7f3a\u5c11\u201c_validation\u201d\u3002\u89e3\u51b3\u529e\u6cd5\u662f\u5728setup\u6587\u4ef6\u4e2d\u5c06validation\u624b\u52a8include\u8fdb\u53bb\uff0c\u50cf\u8fd9\u6837\uff1a # mysetup.py import sys sys.setrecursionlimit(50000) from distutils.core import setup import py2exe options = { &#8220;py2exe&#8221;: {&#8220;compressed&#8221;:1, &#8220;optimize&#8221;:2, &#8220;includes&#8221;:[&#8220;scipy.sparse.csgraph._validation&#8221;,&#8221;scipy.special._ufuncs_cxx&#8221;,&#8221;sympy.printing.gtk&#8221;], &#8220;bundle_files&#8221;:1} }; setup( windows = [&#8220;nlk.py&#8221;], options = options, ) \u5176\u4e2d\u7684scipy.sparse.csgraph._validation&#8221;,&#8221;scipy.special._ufuncs_cxx&#8221;,&#8221;sympy.printing.gtk\u90fd\u662f\u6839\u636e\u540e\u6765\u7684\u62a5\u9519\u9010\u4e2a\u6dfb\u52a0\u8fdb\u53bb\u7684\u3002\u671f\u95f4\u8fd8\u5b89\u88c5\u4e86gtk\u8fd9\u4e2a\u5305\u3002\u81f3\u4e8e\u8fd9\u662f\u4e2a\u5565\uff1f\u4e0d\u77e5\u9053\u3002 3.\u6700\u540e\u4e00\u4e2a\u95ee\u9898\u662f\u5982\u4e0b\u62a5\u9519\uff1a OMP: Warning #178: Function GetModuleHandleEx failed OMP: System error #126: The specified module could [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/posts\/117"}],"collection":[{"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.actinia.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":2,"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":119,"href":"https:\/\/www.actinia.me\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions\/119"}],"wp:attachment":[{"href":"https:\/\/www.actinia.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.actinia.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.actinia.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}