{"id":177,"date":"2018-09-12T14:26:41","date_gmt":"2018-09-12T06:26:41","guid":{"rendered":"http:\/\/www.yinyubo.cn\/?p=177"},"modified":"2022-05-17T09:50:21","modified_gmt":"2022-05-17T01:50:21","slug":"wxpythonpyinstallerpyecharts","status":"publish","type":"post","link":"https:\/\/www.yinyubo.com\/?p=177","title":{"rendered":"wxpython\u52a0pyinstaller\u52a0pyecharts(\u89e3\u51b3python\u6253\u5305exe\u4e0d\u517c\u5bb9\u95ee\u9898)"},"content":{"rendered":"<h1>\u7b80\u5355\u4ecb\u7ecd\uff1awxpython\u548cpyecharts\u53ef\u4ee5\u642d\u914d\u4f7f\u7528\uff0c\u5728\u684c\u9762\u7a0b\u5e8f\u4e2d\u5c55\u793aweb\u5f62\u5f0f\u7684\u56fe\u8868\u3002\u4f46\u662f\u5728\u4f7f\u7528pyinstaller\u6253\u5305\u6210exe\u6587\u4ef6\u540e\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u5982\u4e0bBUG:<\/h1>\n<h2><span style=\"color: #ff6600;\">BUG1\uff1a\u5728\u7528pyinstaller\u5c06wxpython\u7a0b\u5e8f\u6253\u5305\u6210exe\u6587\u4ef6\u540e\uff0c\u8fd0\u884c\u4f1a\u53d1\u751f<code><span class=\"typ\">TemplateNotFound<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> simple_chart<\/span><span class=\"pun\">.<\/span><span class=\"pln\">html<\/span><\/code>\u7684\u62a5\u9519\u4fe1\u606f\u3002<\/span><\/h2>\n<p>\u8fd9\u65f6\u5019\uff0c\u9700\u8981\u628apyechats \u7684\u5728python\u73af\u5883\u91cc\u7684html\u6587\u4ef6\u62f7\u8d1d\u51fa\u6765\uff0c\u76ee\u5f55\u7528\/pyecharts\/templates\/ \u7136\u540e\u653e\u7f6e\u5728pyinstall\u6253\u5305\u540e\u7684\u4e3b\u7a0b\u5e8f\u6587\u4ef6\u5939\u76ee\u5f55\u4e0b<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-231 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/Image-3.png\" alt=\"\" width=\"805\" height=\"295\" \/><\/p>\n<h2><span style=\"color: #ff6600;\">BUG2.\u751f\u6210\u4e86HTML\u6587\u4ef6\u4e4b\u540e\uff0c\u6ca1\u6709\u52a0\u8f7dJS<\/span><\/h2>\n<p>1.\u53bbecharts\u5b98\u7f51\u4e0b\u8f7decharts.common.min.js\u653e\u5728resource\u76ee\u5f55\u4e0b<br \/>\n2.\u4fee\u6539Lib\\site-packages\\pyecharts\\templates\\\u7684simple_page.html\u548csimple_chart.html \u7684{{ echarts_js_dependencies(chart) }} \u53d8\u6210&lt;script type=&#8221;text\/javascript&#8221; src=&#8221;..\/echarts.common.min.js&#8221;&gt;&lt;\/script&gt;\uff0c\u7136\u540e\u91cd\u65b0\u6253\u5305<br \/>\n(\u8865\u5145\u89e3\u91ca\uff1a\u628aecharts.common.min.js \u653e\u5728pyecharts\u751f\u6210\u7684HTML\u6587\u4ef6\u7684\u4e0a\u7ea7\u76ee\u5f55\u91cc,\u5bf9\u5e94src=&#8221;..\/echarts.common.min.js&#8221;)<br \/>\n<span style=\"font-size: 1rem;\">4.\u4fee\u6539wxpython\u7684\u4ee3\u7801\uff0c\u5728frame\u91cc\u589e\u52a0\u4e00\u4e2awebview<\/span><\/p>\n<pre class=\"lang:python decode:true EnlighterJSRAW\" data-enlighter-language=\"golang\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">self.frame = reportFrame.MyFrame(None, wx.ID_ANY, \"\")\nself.wv = webview.WebView.New(self.frame.panel_1, size=(500, 600)) # \u52a0\u4e86\u8fd9\u884c\u5c31\u80fd\u6574\u4f53\u62d6\u52a8\u4e86\nname = os.path.abspath(os.getcwd() + '.\/resource\/reports\/init_report.html')\nself.wv.LoadURL(\"file:\/\/\/\"+name)<\/code><\/pre>\n<p>5.\u628apyecharts\/template\u76ee\u5f55\u548cresource\u76ee\u5f55\u4e00\u8d77\u62f7\u8d1d\u5230manage\u76ee\u5f55\u4e0b(manage\u662f\u56e0\u4e3a\u6211\u6253\u5305\u7684\u65f6\u5019\u7528\u7684\u547d\u4ee4\u662fpyinstaller -D manage.py)<br \/>\n\u56e0\u4e3a\u6709\u8bfb\u8005\u4e0d\u662f\u5f88\u660e\u767d\u6587\u4ef6\u7ed3\u6784\uff0c\u4e0b\u9762\u9644\u4e0a\u6211\u7684resource\u76ee\u5f55\u548cpyechart\u751f\u6210\u7684\u7ed3\u6784html\u6587\u4ef6\u76ee\u5f55<br \/>\nresource\u76ee\u5f55<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-305 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/resource\u6587\u4ef6\u622a\u56fe.png\" alt=\"\" width=\"673\" height=\"396\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-306 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/html\u6587\u4ef6\u76ee\u5f55.png\" alt=\"\" width=\"749\" height=\"502\" \/><br \/>\n\u751f\u6210\u7684html\u6587\u4ef6\u91cc\u7684\u5185\u5bb9<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-307 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/echarts-html.png\" alt=\"\" width=\"726\" height=\"179\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u5355\u4ecb\u7ecd\uff1awxpython\u548cpyecharts\u53ef\u4ee5\u642d\u914d\u4f7f\u7528\uff0c\u5728\u684c\u9762\u7a0b\u5e8f\u4e2d\u5c55\u793aweb\u5f62\u5f0f\u7684\u56fe\u8868\u3002\u4f46\u662f\u5728\u4f7f\u7528pyi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":231,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177"}],"version-history":[{"count":2,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":1089,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions\/1089"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/media\/231"}],"wp:attachment":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}