{"id":2350,"date":"2023-08-12T14:48:40","date_gmt":"2023-08-12T06:48:40","guid":{"rendered":"http:\/\/xinyixx.com\/?p=2350"},"modified":"2023-08-12T14:49:07","modified_gmt":"2023-08-12T06:49:07","slug":"python27","status":"publish","type":"post","link":"https:\/\/www.xinyixx.com\/index.php\/2023\/08\/12\/python27\/","title":{"rendered":"python\u7a0b\u5e8f27\uff1a\u5199\u4e00\u4e2a\u6279\u91cf\u63d0\u53d6\u8868\u683c\u4fe1\u606f\u7684\u7a0b\u5e8f"},"content":{"rendered":"<p>\u4e66\u63a5\u4e0a\u56de\uff0c\u5728python\u7a0b\u5e8f26\u4e2d\u6211\u5199\u4e86\u4e00\u4e2a\u5173\u4e8e\u63d0\u53d6word\u5185\u8868\u683c\u7684\u7a0b\u5e8f\uff0c\u4e0b\u9762\u9700\u8981\u5199\u4e2a\u6279\u91cf\u63d0\u53d6\u8868\u683c\u4fe1\u606f\u7684\u7a0b\u5e8f\uff0c\u6765\u5bf9\u8fd9\u4e48\u591a\u7684\u8868\u683c\u8fdb\u884c\u6570\u636e\u7684\u63d0\u53d6\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u4ecd\u7136\u9700\u8981\u5728\u7ec8\u7aef\u7a97\u53e3\u5185\u7528pip install\u5f15\u5165\u6a21\u5757\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u5b9e\u73b0\u6279\u91cf\u63d0\u53d6\u8868\u683c\u4fe1\u606f\u7684\u7a0b\u5e8f\u6e90\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import os\nimport openpyxl\nfrom tkinter import *\nfrom tkinter import filedialog\n\n# \u5b9a\u4e49UI\u754c\u9762\nclass App:\n    def __init__(self, master):\n        self.master = master\n        master.title('Excel\u5185\u5bb9\u67e5\u627e\u5668')\n        master.geometry('350x600')\n\n        # \u521b\u5efa\u6587\u4ef6\u5939\u9009\u62e9\u6309\u94ae\n        self.folder_button = Button(master, text='\u9009\u62e9\u6587\u4ef6\u5939', command=self.select_folder)\n        self.folder_button.pack()\n\n        # \u521b\u5efa\u67e5\u627e\u5185\u5bb9\u8f93\u5165\u6846\u548c\u6309\u94ae\n        self.search_label = Label(master, text='\u8bf7\u8f93\u5165\u8981\u67e5\u627e\u7684\u5185\u5bb9\uff1a')\n        self.search_label.pack()\n\n        # \u521b\u5efa20\u4e2a\u6587\u672c\u6846\uff0c\u7528\u4e8e\u8f93\u5165\u9700\u8981\u67e5\u627e\u7684\u5185\u5bb9\n        self.search_entries = []\n        for i in range(20):\n            search_entry = Entry(master)\n            search_entry.pack()\n            self.search_entries.append(search_entry)\n\n        # \u521b\u5efa\u5bfc\u51fa\u8def\u5f84\u8f93\u5165\u6846\u548c\u6309\u94ae\n        self.export_label = Label(master, text='\u8bf7\u9009\u62e9\u5bfc\u51fa\u8def\u5f84\uff1a')\n        self.export_label.pack()\n        self.export_entry = Entry(master)\n        self.export_entry.pack()\n        self.export_button = Button(master, text='\u9009\u62e9\u8def\u5f84', command=self.select_export_path)\n        self.export_button.pack()\n\n        # \u521b\u5efa\u5f00\u59cb\u67e5\u627e\u6309\u94ae\n        self.search_button = Button(master, text='\u5f00\u59cb\u67e5\u627e', command=self.search)\n        self.search_button.pack()\n\n        # \u521b\u5efa\u72b6\u6001\u680f\n        self.status_label = Label(master, text='')\n        self.status_label.pack()\n\n    # \u9009\u62e9\u6587\u4ef6\u5939\n    def select_folder(self):\n        self.folder_path = filedialog.askdirectory()\n        self.status_label.config(text=f'\u5df2\u9009\u62e9\u6587\u4ef6\u5939\uff1a{self.folder_path}')\n\n    # \u9009\u62e9\u5bfc\u51fa\u8def\u5f84\n    def select_export_path(self):\n        export_path = filedialog.asksaveasfilename(defaultextension='.xlsx')\n        self.export_entry.delete(0, END)\n        self.export_entry.insert(END, export_path)\n\n    # \u67e5\u627e\u6307\u5b9a\u5185\u5bb9\n    def search(self):\n        # \u83b7\u53d6\u8981\u67e5\u627e\u7684\u5185\u5bb9\u5217\u8868\n        search_texts = [entry.get().strip() for entry in self.search_entries if entry.get().strip()]\n\n        if not search_texts:\n            self.status_label.config(text='\u8bf7\u81f3\u5c11\u8f93\u5165\u4e00\u4e2a\u8981\u67e5\u627e\u7684\u5185\u5bb9')\n            return\n\n        # \u83b7\u53d6\u5bfc\u51fa\u8def\u5f84\n        export_path = self.export_entry.get().strip()\n        if not export_path:\n            self.status_label.config(text='\u8bf7\u9009\u62e9\u5bfc\u51fa\u8def\u5f84')\n            return\n\n        # \u521b\u5efa\u65b0\u7684Excel\u6587\u4ef6\n        export_wb = openpyxl.Workbook()\n        export_ws = export_wb.active\n\n        # \u904d\u5386\u6587\u4ef6\u5939\u5185\u7684\u6240\u6709Excel\u6587\u4ef6\n        for filename in os.listdir(self.folder_path):\n            if filename.endswith('.xlsx'):\n                # \u6253\u5f00Excel\u6587\u4ef6\n                filepath = os.path.join(self.folder_path, filename)\n                wb = openpyxl.load_workbook(filepath)\n\n                # \u904d\u5386Excel\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u5de5\u4f5c\u8868\n                for sheetname in wb.sheetnames:\n                    ws = wb[sheetname]\n\n                    # \u904d\u5386\u5de5\u4f5c\u8868\u4e2d\u7684\u6240\u6709\u5355\u5143\u683c\n                    for row in ws.iter_rows():\n                        for cell in row:\n                            for search_text in search_texts:\n                                if search_text in str(cell.value):\n                                    # \u5982\u679c\u627e\u5230\u6307\u5b9a\u5185\u5bb9\uff0c\u63d0\u53d6\u6240\u9700\u5185\u5bb9\u548c\u7d27\u968f\u5176\u540e\u7684\u8868\u683c\u6570\u636e\n                                    extract_data(wb, sheetname, cell.row, filepath, search_text, export_ws)\n\n        # \u4fdd\u5b58\u5e76\u5173\u95ed\u65b0\u7684Excel\u6587\u4ef6\n        export_wb.save(export_path)\n        export_wb.close()\n\n        self.status_label.config(text='\u67e5\u627e\u5b8c\u6210')\n\n# \u63d0\u53d6\u6240\u9700\u5185\u5bb9\u548c\u7d27\u968f\u5176\u540e\u7684\u8868\u683c\u6570\u636e\ndef extract_data(wb, sheetname, row, filepath, search_text, export_ws):\n    ws = wb[sheetname]\n\n    # \u63d0\u53d6\u6240\u9700\u5185\u5bb9\n    data = [search_text]\n    for col in range(1, ws.max_column + 1):\n        data.append(ws.cell(row=row, column=col).value)\n\n    # \u5c06\u6570\u636e\u5199\u5165\u65b0\u7684Excel\u6587\u4ef6\n    export_ws.append(data)\n\n# \u521b\u5efaUI\u754c\u9762\u5e76\u8fd0\u884c\u7a0b\u5e8f\nroot = Tk()\napp = App(root)\nroot.mainloop()\n<\/pre>\n\n\n\n<p>\u76f4\u63a5\u8fd0\u884c\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u5f97\u5230\u4e0b\u9762\u957f\u5bbd\u4e3a350&#215;600\u7684UI\u754c\u9762\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"366\" height=\"639\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67.png\" alt class=\"wp-image-2354\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67.png 366w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67-172x300.png 172w\" sizes=\"(max-width: 366px) 100vw, 366px\"><\/noscript><img decoding=\"async\" width=\"366\" height=\"639\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20366%20639%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2354 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20366%20639%22%3E%3C%2Fsvg%3E 366w\" sizes=\"(max-width: 366px) 100vw, 366px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67.png 366w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67-172x300.png 172w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-67.png\"><\/figure>\n\n\n\n<p>\u9009\u62e9\u6587\u4ef6\u5939\u4e3a\u53ef\u4ee5\u9009\u62e9\u81ea\u5df1\u5b58\u653e\u591a\u4e2aexcel\u7684\u6587\u4ef6\u5939\uff0c\u6bd4\u5982\u6211\u8fd9\u91cc\u9009\u62e9\u4e4b\u524d\u751f\u6210\u7684\u540d\u4e3a13\u7684\u6587\u4ef6\u5939\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><noscript><img decoding=\"async\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68.png\" alt class=\"wp-image-2355\" style=\"width:840px;height:473px\" width=\"840\" height=\"473\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68.png 960w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68-300x169.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68-768x432.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\"><\/noscript><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20840%20473%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2355 lazyload\" style=\"width:840px;height:473px\" width=\"840\" height=\"473\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20840%20473%22%3E%3C%2Fsvg%3E 840w\" sizes=\"(max-width: 840px) 100vw, 840px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68.png 960w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68-300x169.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68-768x432.png 768w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-68.png\"><\/figure>\n\n\n\n<p>\u7136\u540e\u9009\u62e9\u8f93\u51fa\u8def\u5f84\uff0c\u5e76\u547d\u540d\u4e00\u4e2a\u8f93\u51fa\u7684excel\u6587\u4ef6\u540d\u79f0\uff0c\u5982\u4e0b\u56fe\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"960\" height=\"540\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69.png\" alt class=\"wp-image-2356\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69.png 960w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69-300x169.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69-768x432.png 768w\" sizes=\"(max-width: 960px) 100vw, 960px\"><\/noscript><img decoding=\"async\" width=\"960\" height=\"540\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20960%20540%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2356 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20960%20540%22%3E%3C%2Fsvg%3E 960w\" sizes=\"(max-width: 960px) 100vw, 960px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69.png 960w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69-300x169.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69-768x432.png 768w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-69.png\"><\/figure>\n\n\n\n<p>\u7136\u540e\u5728\u8fd9\u4e2a\u57fa\u7840\u4e0a\u5728\u6587\u672c\u6846\u5185\u8f93\u5165\u9700\u8981\u67e5\u627e\u7684\u5185\u5bb9\uff0c\u8fd9\u91cc\u6211\u9ed8\u8ba4\u5199\u4e86\u53ef\u67e5\u627e\u5185\u5bb9\u4e3a12\uff0c\u5176\u5b9e\u53ef\u4ee5\u5199\u5165\u66f4\u591a\uff0c\u901a\u8fc7\u4fee\u6539\u6e90\u4ee3\u7801\u53ef\u4ee5\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"366\" height=\"639\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70.png\" alt class=\"wp-image-2357\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70.png 366w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70-172x300.png 172w\" sizes=\"(max-width: 366px) 100vw, 366px\"><\/noscript><img decoding=\"async\" width=\"366\" height=\"639\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20366%20639%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2357 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20366%20639%22%3E%3C%2Fsvg%3E 366w\" sizes=\"(max-width: 366px) 100vw, 366px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70.png 366w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70-172x300.png 172w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-70.png\"><\/figure>\n\n\n\n<p>\u6700\u540e\u70b9\u51fb\u5f00\u59cb\u67e5\u627e\uff0c\u6700\u4e0b\u65b9\u63d0\u793a\u4fe1\u606f\u4f1a\u63d0\u793a\u67e5\u627e\u5b8c\u6210\u5c31\u8bf4\u660e\u5df2\u7ecf\u627e\u5230\u81ea\u5df1\u9700\u8981\u7684\u4fe1\u606f\u5e76\u63d0\u53d6\u5230excel\u4e2d\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u6253\u5f00excel\u67e5\u770b\u4e00\u4e0b\u5f97\u5230\u7684excel\u4fe1\u606f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><noscript><img decoding=\"async\" width=\"725\" height=\"197\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71.png\" alt class=\"wp-image-2358\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71.png 725w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71-300x82.png 300w\" sizes=\"(max-width: 725px) 100vw, 725px\"><\/noscript><img decoding=\"async\" width=\"725\" height=\"197\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20725%20197%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2358 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20725%20197%22%3E%3C%2Fsvg%3E 725w\" sizes=\"(max-width: 725px) 100vw, 725px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71.png 725w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71-300x82.png 300w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-71.png\"><\/figure>\n\n\n\n<p>\u901a\u8fc7\u8fd9\u4e2a\u7a0b\u5e8f\u5c31\u4e0d\u9700\u8981\u81ea\u5df1\u518d\u8fd9\u4e48\u591a\u8868\u683c\u5185\u4e00\u4e2a\u4e00\u4e2a\u67e5\u627e\u81ea\u5df1\u9700\u8981\u7684\u5185\u5bb9\u4e86\uff0c\u65e2\u8d39\u65f6\u800c\u4e14\u4e0d\u51c6\u786e\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u518d\u8bb2\u4e00\u4e0b\u5c06python\u6e90\u7801\u5c01\u88c5\u6210\u7684\u6b65\u9aa4\uff0c\u5728python\u7a0b\u5e8f1\u4e2d\u6211\u6709\u4ecb\u7ecd\u7528pyinstaller\u5c01\u88c5\u7684\u65b9\u6cd5\uff1a<a href=\"http:\/\/xinyixx.com\/index.php\/2023\/05\/27\/python1\/\">\u6559\u5927\u5bb6\u5199\u4e00\u4e2apython\u7684\u4ea4\u4e92\u5f0f.exe\u7a0b\u5e8f | \u9ad8\u6cbb\u4e2d\u7684\u4e2a\u4eba\u7a7a\u95f4 (xinyixx.com)<\/a>\u3002\u8fd9\u91cc\u6211\u4ecb\u7ecd\u53e6\u5916\u4e00\u79cd\u7528\u81ea\u5df1\u6bd4\u8f83\u4e60\u60ef\u7684\u65b9\u5f0f\u8fdb\u884c\u5c01\u88c5\u7684\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u9700\u8981\u627e\u5230\u6a21\u5757\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u6bd4\u5982\u6211\u7684\u662f\uff1aC:\\Users\\\u6768\u4e1c\u65ed\\PycharmProjects\\pythonProject7\\venv\\Scripts  \u5c06\u4e0a\u9762\u7684\u6e90\u7801\u62f7\u8d1d\u5230\u6b64\u8def\u5f84\u4e0b\uff1a<\/p>\n\n\n\n<p>\u5728pycharm\u4e2d\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5cx_Freeze\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>pip install cx_Freeze<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><noscript><img decoding=\"async\" width=\"1024\" height=\"242\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-1024x242.png\" alt class=\"wp-image-2360\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-1024x242.png 1024w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-300x71.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-768x182.png 768w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73.png 1227w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/noscript><img decoding=\"async\" width=\"1024\" height=\"242\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201024%20242%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2360 lazyload\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201024%20242%22%3E%3C%2Fsvg%3E 1024w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-1024x242.png 1024w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-300x71.png 300w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-768x182.png 768w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73.png 1227w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-73-1024x242.png\"><\/figure>\n\n\n\n<p>\u5728Scripts \u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3asetup.py\u7684\u6587\u4ef6\uff0c\u4e0b\u9762\u662f\u6e90\u7801<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import sys\nfrom cx_Freeze import setup, Executable\n\nbuild_exe_options = {\"packages\": [\"os\"], \"excludes\": [\"tkinter\"]}\n\nbase = None\nif sys.platform == \"win32\":\n    base = \"Win32GUI\"\n\nsetup(\n    name=\"\u7a0b\u5e8f\u540d\u79f0\",\n    version=\"1.0\",\n    description=\"My Application Description\",\n    options={\"build_exe\": build_exe_options},\n    executables=[Executable(\"\u4f60\u7684\u6e90\u7801.py\u540d\u79f0.py\", base=base)]\n)\n<\/pre>\n\n\n\n<p>\u6ce8\u610f\u8fd9\u91cc\u7684 <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-header-gradient-color\">\u7a0b\u5e8f\u540d\u79f0<\/mark> \u548c <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-header-gradient-color\">\u4f60\u7684\u6e90\u7801.py\u540d\u79f0<\/mark> \u66f4\u6539\u4e3a\u81ea\u5df1\u5bf9\u5e94\u7684\u7a0b\u5e8f\u548c\u6587\u4ef6\u540d<\/p>\n\n\n\n<p>\u6700\u540e\u5728..\\pythonProject7\\venv\\Scripts \u8def\u5f84\u4e0b\u6267\u884c\uff1a<code>python setup.py build<\/code><\/p>\n\n\n\n<p>\u4f1a\u5f97\u5230build\u540d\u79f0\u7684\u6587\u4ef6\u5939\uff0c\u91cc\u9762\u5c31\u6709.exe\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><noscript><img decoding=\"async\" src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72.png\" alt class=\"wp-image-2359\" style=\"width:701px;height:330px\" width=\"701\" height=\"330\" srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72.png 733w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72-300x141.png 300w\" sizes=\"(max-width: 701px) 100vw, 701px\"><\/noscript><img decoding=\"async\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20701%20330%22%3E%3C%2Fsvg%3E\" alt class=\"wp-image-2359 lazyload\" style=\"width:701px;height:330px\" width=\"701\" height=\"330\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20701%20330%22%3E%3C%2Fsvg%3E 701w\" sizes=\"(max-width: 701px) 100vw, 701px\" data-srcset=\"https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72.png 733w, https:\/\/www.xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72-300x141.png 300w\" data-src=\"http:\/\/xinyixx.com\/wp-content\/uploads\/2023\/08\/image-72.png\"><\/figure>\n\n\n\n<p>\u611f\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u5728pycharm\u96c6\u6210\u73af\u5883\u4e0b\u5c1d\u8bd5\uff0c\u6709\u95ee\u9898\u53ef\u4ee5\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e66\u63a5\u4e0a\u56de\uff0c\u5728python\u7a0b\u5e8f26\u4e2d\u6211\u5199\u4e86\u4e00\u4e2a\u5173\u4e8e\u63d0\u53d6word\u5185\u8868\u683c\u7684\u7a0b\u5e8f\uff0c\u4e0b\u9762\u9700\u8981\u5199\u4e2a\u6279\u91cf\u63d0\u53d6\u8868\u683c\u4fe1\u606f\u7684\u7a0b\u5e8f\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[14,10],"tags":[71,69,77],"class_list":["post-2350","post","type-post","status-publish","format-standard","hentry","category-teacher","category-coding","tag-python","tag-learning","tag-coding","entry"],"_links":{"self":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/2350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/comments?post=2350"}],"version-history":[{"count":0,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/posts\/2350\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/media?parent=2350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/categories?post=2350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xinyixx.com\/index.php\/wp-json\/wp\/v2\/tags?post=2350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}