{"id":1109744,"date":"2025-01-08T17:12:59","date_gmt":"2025-01-08T09:12:59","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1109744.html"},"modified":"2025-01-08T17:13:02","modified_gmt":"2025-01-08T09:13:02","slug":"python%e5%a6%82%e4%bd%95%e8%83%bd%e5%81%9a%e6%88%90%e4%b8%80%e4%b8%aaapp","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1109744.html","title":{"rendered":"python\u5982\u4f55\u80fd\u505a\u6210\u4e00\u4e2aapp"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25072858\/1e942872-aa3e-45ec-86c9-392a0ba49ea9.webp\" alt=\"python\u5982\u4f55\u80fd\u505a\u6210\u4e00\u4e2aapp\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u5236\u4f5c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6\u3001\u8bbe\u8ba1\u7528\u6237\u754c\u9762\u3001\u96c6\u6210\u540e\u7aef\u670d\u52a1\u3001\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002<\/strong> \u5176\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6\u662f\u6700\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u6846\u67b6\u51b3\u5b9a\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u7ed3\u6784\u548c\u529f\u80fd\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u6b65\u9aa4\u548c\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<\/p>\n<h2><strong>\u4e00\u3001\u9009\u62e9\u6846\u67b6<\/strong><\/h2>\n<p><h2>1\u3001Kivy<\/h2>\n<\/p>\n<p><p>Kivy\u662f\u4e00\u4e2a\u5f00\u6e90\u7684Python\u5e93\uff0c\u7528\u4e8e\u5f00\u53d1\u591a\u70b9\u89e6\u63a7\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u652f\u6301\u8de8\u5e73\u53f0\u5f00\u53d1\uff0c\u53ef\u4ee5\u5728Windows\u3001macOS\u3001Linux\u3001iOS\u548cAndroid\u4e0a\u8fd0\u884c\u3002Kivy\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684UI\u7ec4\u4ef6\uff0c\u5982\u6309\u94ae\u3001\u6807\u7b7e\u3001\u6587\u672c\u8f93\u5165\u7b49\uff0c\u65b9\u4fbf\u5feb\u901f\u5f00\u53d1\u7528\u6237\u754c\u9762\u3002<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5Kivy\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install kivy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from kivy.app import App<\/p>\n<p>from kivy.uix.label import Label<\/p>\n<p>class MyApp(App):<\/p>\n<p>    def build(self):<\/p>\n<p>        return Label(text=&quot;Hello, Kivy!&quot;)<\/p>\n<p>if __name__ == &quot;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&quot;:<\/p>\n<p>    MyApp().run()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001PyQt<\/h2>\n<\/p>\n<p><p>PyQt\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python\u5e93\uff0c\u7528\u4e8e\u521b\u5efa\u8de8\u5e73\u53f0\u7684\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u57fa\u4e8eQt\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684UI\u7ec4\u4ef6\u548c\u5f3a\u5927\u7684\u529f\u80fd\u652f\u6301\u3002PyQt\u9002\u5408\u7528\u4e8e\u5f00\u53d1\u9700\u8981\u590d\u6742UI\u548c\u9ad8\u7ea7\u529f\u80fd\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5PyQt\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install PyQt5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>from PyQt5.QtWidgets import QApplication, QLabel<\/p>\n<p>app = QApplication(sys.argv)<\/p>\n<p>label = QLabel(&quot;Hello, PyQt!&quot;)<\/p>\n<p>label.show()<\/p>\n<p>sys.exit(app.exec_())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u4e8c\u3001\u8bbe\u8ba1\u7528\u6237\u754c\u9762<\/strong><\/h2>\n<p><h2>1\u3001\u5e03\u5c40\u7ba1\u7406<\/h2>\n<\/p>\n<p><p>\u65e0\u8bba\u4f7f\u7528\u54ea\u4e2a\u6846\u67b6\uff0c\u5e03\u5c40\u7ba1\u7406\u90fd\u662f\u8bbe\u8ba1\u7528\u6237\u754c\u9762\u7684\u5173\u952e\u3002Kivy\u63d0\u4f9b\u4e86\u591a\u79cd\u5e03\u5c40\uff0c\u5982BoxLayout\u3001GridLayout\u7b49\u3002PyQt\u5219\u63d0\u4f9b\u4e86QVBoxLayout\u3001QHBoxLayout\u7b49\u3002<\/p>\n<\/p>\n<p><h3>Kivy\u5e03\u5c40\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">from kivy.app import App<\/p>\n<p>from kivy.uix.boxlayout import BoxLayout<\/p>\n<p>from kivy.uix.button import Button<\/p>\n<p>class MyApp(App):<\/p>\n<p>    def build(self):<\/p>\n<p>        layout = BoxLayout(orientation=&#39;vertical&#39;)<\/p>\n<p>        layout.add_widget(Button(text=&#39;Button 1&#39;))<\/p>\n<p>        layout.add_widget(Button(text=&#39;Button 2&#39;))<\/p>\n<p>        return layout<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    MyApp().run()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>PyQt\u5e03\u5c40\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton<\/p>\n<p>class MyApp(QWidget):<\/p>\n<p>    def __init__(self):<\/p>\n<p>        super().__init__()<\/p>\n<p>        layout = QVBoxLayout()<\/p>\n<p>        layout.addWidget(QPushButton(&#39;Button 1&#39;))<\/p>\n<p>        layout.addWidget(QPushButton(&#39;Button 2&#39;))<\/p>\n<p>        self.setLayout(layout)<\/p>\n<p>app = QApplication(sys.argv)<\/p>\n<p>window = MyApp()<\/p>\n<p>window.show()<\/p>\n<p>sys.exit(app.exec_())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001\u4e8b\u4ef6\u5904\u7406<\/h2>\n<\/p>\n<p><p>\u4e8b\u4ef6\u5904\u7406\u662f\u5e94\u7528\u7a0b\u5e8f\u4ea4\u4e92\u7684\u91cd\u8981\u90e8\u5206\u3002Kivy\u4f7f\u7528\u4e8b\u4ef6\u7ed1\u5b9a\u673a\u5236\uff0cPyQt\u5219\u4f7f\u7528\u4fe1\u53f7\u548c\u69fd\u673a\u5236\u3002<\/p>\n<\/p>\n<p><h3>Kivy\u4e8b\u4ef6\u5904\u7406\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">from kivy.app import App<\/p>\n<p>from kivy.uix.button import Button<\/p>\n<p>class MyApp(App):<\/p>\n<p>    def build(self):<\/p>\n<p>        button = Button(text=&quot;Press me&quot;)<\/p>\n<p>        button.bind(on_press=self.on_button_press)<\/p>\n<p>        return button<\/p>\n<p>    def on_button_press(self, instance):<\/p>\n<p>        print(&quot;Button pressed!&quot;)<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    MyApp().run()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>PyQt\u4e8b\u4ef6\u5904\u7406\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>from PyQt5.QtWidgets import QApplication, QPushButton, QWidget<\/p>\n<p>class MyApp(QWidget):<\/p>\n<p>    def __init__(self):<\/p>\n<p>        super().__init__()<\/p>\n<p>        button = QPushButton(&#39;Press me&#39;, self)<\/p>\n<p>        button.clicked.connect(self.on_button_click)<\/p>\n<p>    def on_button_click(self):<\/p>\n<p>        print(&quot;Button pressed!&quot;)<\/p>\n<p>app = QApplication(sys.argv)<\/p>\n<p>window = MyApp()<\/p>\n<p>window.show()<\/p>\n<p>sys.exit(app.exec_())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u4e09\u3001\u96c6\u6210\u540e\u7aef\u670d\u52a1<\/strong><\/h2>\n<p><p>\u5728\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u540e\u7aef\u670d\u52a1\u7684\u96c6\u6210\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002Python\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5e93\u548c\u6846\u67b6\uff0c\u5982Flask\u548cDjango\uff0c\u7528\u4e8e\u521b\u5efa\u540e\u7aef\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><h2>1\u3001Flask<\/h2>\n<\/p>\n<p><p>Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684Web\u6846\u67b6\uff0c\u9002\u5408\u7528\u4e8e\u5f00\u53d1\u7b80\u5355\u7684API\u548cWeb\u670d\u52a1\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684Flask\u5e94\u7528\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5Flask\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install flask<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684API\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask, jsonify<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>@app.route(&#39;\/api\/data&#39;, methods=[&#39;GET&#39;])<\/p>\n<p>def get_data():<\/p>\n<p>    return jsonify({&quot;message&quot;: &quot;Hello, Flask!&quot;})<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001Django<\/h2>\n<\/p>\n<p><p>Django\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Web\u6846\u67b6\uff0c\u9002\u5408\u7528\u4e8e\u5f00\u53d1\u590d\u6742\u7684Web\u5e94\u7528\u7a0b\u5e8f\u548cAPI\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684Django\u5e94\u7528\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5Django\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install django<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2aDjango\u9879\u76ee\u548c\u5e94\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">django-admin startproject myproject<\/p>\n<p>cd myproject<\/p>\n<p>django-admin startapp myapp<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>myapp\/views.py<\/code>\u4e2d\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u89c6\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.http import JsonResponse<\/p>\n<p>def get_data(request):<\/p>\n<p>    return JsonResponse({&quot;message&quot;: &quot;Hello, Django!&quot;})<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728<code>myproject\/urls.py<\/code>\u4e2d\u914d\u7f6e\u8def\u7531\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.contrib import admin<\/p>\n<p>from django.urls import path<\/p>\n<p>from myapp import views<\/p>\n<p>urlpatterns = [<\/p>\n<p>    path(&#39;admin\/&#39;, admin.site.urls),<\/p>\n<p>    path(&#39;api\/data\/&#39;, views.get_data),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u56db\u3001\u6d4b\u8bd5\u548c\u8c03\u8bd5<\/strong><\/h2>\n<p><p>\u6d4b\u8bd5\u548c\u8c03\u8bd5\u662f\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u8d28\u91cf\u7684\u91cd\u8981\u6b65\u9aa4\u3002Python\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6d4b\u8bd5\u6846\u67b6\u548c\u8c03\u8bd5\u5de5\u5177\uff0c\u5982unittest\u548cpdb\u3002<\/p>\n<\/p>\n<p><h2>1\u3001\u5355\u5143\u6d4b\u8bd5<\/h2>\n<\/p>\n<p><p>\u5355\u5143\u6d4b\u8bd5\u7528\u4e8e\u9a8c\u8bc1\u4ee3\u7801\u7684\u5404\u4e2a\u90e8\u5206\u662f\u5426\u6309\u9884\u671f\u5de5\u4f5c\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5355\u5143\u6d4b\u8bd5\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528unittest\u8fdb\u884c\u6d4b\u8bd5<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import unittest<\/p>\n<p>def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<p>class TestMath(unittest.TestCase):<\/p>\n<p>    def test_add(self):<\/p>\n<p>        self.assertEqual(add(1, 2), 3)<\/p>\n<p>        self.assertEqual(add(-1, 1), 0)<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    unittest.main()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001\u8c03\u8bd5<\/h2>\n<\/p>\n<p><p>\u8c03\u8bd5\u7528\u4e8e\u67e5\u627e\u548c\u4fee\u590d\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\u3002Python\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u8c03\u8bd5\u5de5\u5177pdb\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8c03\u8bd5\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528pdb\u8fdb\u884c\u8c03\u8bd5<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import pdb<\/p>\n<p>def buggy_function(a, b):<\/p>\n<p>    result = a + b<\/p>\n<p>    pdb.set_trace()  # \u8bbe\u7f6e\u65ad\u70b9<\/p>\n<p>    return result<\/p>\n<p>print(buggy_function(1, 2))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<h2><strong>\u4e94\u3001\u6253\u5305\u548c\u53d1\u5e03<\/strong><\/h2>\n<p><p>\u6700\u540e\uff0c\u5c06\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u548c\u53d1\u5e03\uff0c\u4f7f\u5176\u80fd\u591f\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002Python\u63d0\u4f9b\u4e86\u591a\u79cd\u6253\u5305\u5de5\u5177\uff0c\u5982PyInstaller\u548ccx_Freeze\u3002<\/p>\n<\/p>\n<p><h2>1\u3001PyInstaller<\/h2>\n<\/p>\n<p><p>PyInstaller\u53ef\u4ee5\u5c06Python\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6253\u5305\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5PyInstaller\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install pyinstaller<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u4f7f\u7528PyInstaller\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pyinstaller --onefile myscript.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5728dist\u76ee\u5f55\u4e2d\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>2\u3001cx_Freeze<\/h2>\n<\/p>\n<p><p>cx_Freeze\u662f\u53e6\u4e00\u4e2a\u7528\u4e8e\u6253\u5305Python\u5e94\u7528\u7a0b\u5e8f\u7684\u5de5\u5177\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6253\u5305\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u901a\u8fc7pip\u5b89\u88c5cx_Freeze\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install cx_Freeze<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u521b\u5efa\u4e00\u4e2asetup\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from cx_Freeze import setup, Executable<\/p>\n<p>setup(<\/p>\n<p>    name=&quot;MyApp&quot;,<\/p>\n<p>    version=&quot;0.1&quot;,<\/p>\n<p>    description=&quot;My first Python app&quot;,<\/p>\n<p>    executables=[Executable(&quot;myscript.py&quot;)],<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528cx_Freeze\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python setup.py build<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5728build\u76ee\u5f55\u4e2d\u751f\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u516d\u3001\u603b\u7ed3<\/strong><\/h2>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u8be6\u7ec6\u4e86\u89e3\u4e86\u5982\u4f55\u4f7f\u7528Python\u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u5404\u4e2a\u6b65\u9aa4\uff0c\u5305\u62ec\u9009\u62e9\u6846\u67b6\u3001\u8bbe\u8ba1\u7528\u6237\u754c\u9762\u3001\u96c6\u6210\u540e\u7aef\u670d\u52a1\u3001\u6d4b\u8bd5\u548c\u8c03\u8bd5\u4ee5\u53ca\u6253\u5305\u548c\u53d1\u5e03\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u80fd\u5e2e\u52a9\u4f60\u5feb\u901f\u5165\u95e8\u5e76\u5f00\u53d1\u51fa\u81ea\u5df1\u7684Python\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5f00\u53d1\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\uff1f<\/strong><br \/>Python\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u6846\u67b6\u548c\u5de5\u5177\u6765\u5f00\u53d1\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002\u4f8b\u5982\uff0cKivy\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5f00\u6e90Python\u5e93\uff0c\u4e13\u4e3a\u5f00\u53d1\u8de8\u5e73\u53f0\u5e94\u7528\u800c\u8bbe\u8ba1\u3002\u53e6\u4e00\u4e2a\u9009\u62e9\u662fBeeWare\uff0c\u5b83\u5141\u8bb8\u5f00\u53d1\u8005\u4f7f\u7528Python\u521b\u5efa\u539f\u751f\u5e94\u7528\u3002\u6b64\u5916\uff0cPyQt\u548cPySide\u4e5f\u53ef\u4ee5\u7528\u4e8e\u5f00\u53d1\u684c\u9762\u5e94\u7528\uff0c\u5e76\u901a\u8fc7\u5de5\u5177\u6253\u5305\u4e3a\u79fb\u52a8\u5e94\u7528\u3002<\/p>\n<p><strong>Python\u5f00\u53d1\u5e94\u7528\u9700\u8981\u54ea\u4e9b\u57fa\u672c\u77e5\u8bc6\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Python\u5f00\u53d1\u5e94\u7528\u4e4b\u524d\uff0c\u638c\u63e1\u57fa\u672c\u7684\u7f16\u7a0b\u6982\u5ff5\u975e\u5e38\u91cd\u8981\u3002\u4e86\u89e3\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u3001\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\u662f\u57fa\u7840\u3002\u6b64\u5916\uff0c\u719f\u6089\u76f8\u5173\u7684\u6846\u67b6\u548c\u5e93\uff0c\u5982Flask\u6216Django\uff08\u7528\u4e8eWeb\u5e94\u7528\uff09\uff0c\u4ee5\u53caKivy\u6216BeeWare\uff08\u7528\u4e8e\u79fb\u52a8\u5e94\u7528\uff09\u4e5f\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06Python\u5e94\u7528\u6253\u5305\u6210\u53ef\u5b89\u88c5\u7684\u7a0b\u5e8f\uff1f<\/strong><br \/>\u6253\u5305Python\u5e94\u7528\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982PyInstaller\u3001cx_Freeze\u6216PyOxidizer\u3002\u8fd9\u4e9b\u5de5\u5177\u80fd\u591f\u5c06Python\u4ee3\u7801\u548c\u4f9d\u8d56\u9879\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u65b9\u4fbf\u7528\u6237\u5b89\u88c5\u548c\u4f7f\u7528\u3002\u6b64\u5916\uff0c\u9488\u5bf9\u7279\u5b9a\u5e73\u53f0\uff08\u5982Windows\u3001macOS\u6216Linux\uff09\u6253\u5305\u65f6\uff0c\u9700\u4e86\u89e3\u5404\u5e73\u53f0\u7684\u8981\u6c42\u548c\u6700\u4f73\u5b9e\u8df5\uff0c\u4ee5\u786e\u4fdd\u5e94\u7528\u7684\u517c\u5bb9\u6027\u548c\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u5236\u4f5c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6\u3001\u8bbe\u8ba1\u7528\u6237\u754c\u9762\u3001\u96c6\u6210\u540e\u7aef\u670d\u52a1\u3001\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002 \u5176\u4e2d\uff0c\u9009 [&hellip;]","protected":false},"author":3,"featured_media":1109747,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1109744"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1109744"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1109744\/revisions"}],"predecessor-version":[{"id":1109748,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1109744\/revisions\/1109748"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1109747"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1109744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1109744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1109744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}