{"id":205314,"date":"2025-05-29T16:42:07","date_gmt":"2025-05-29T08:42:07","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205314\/"},"modified":"2025-05-29T16:42:07","modified_gmt":"2025-05-29T08:42:07","slug":"%e5%9c%a8-c-%e4%b8%ad%e8%b0%83%e7%94%a8-python-3-%e7%a8%8b%e5%ba%8f%e6%97%b6%ef%bc%8c%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d%e5%88%9b%e5%bb%ba%e6%96%b0%e7%aa%97%e5%8f%a3%e5%b9%b6%e6%9f%a5%e7%9c%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205314\/","title":{"rendered":"\u5728 C# \u4e2d\u8c03\u7528 Python 3 \u7a0b\u5e8f\u65f6\uff0c\u5982\u4f55\u907f\u514d\u521b\u5efa\u65b0\u7a97\u53e3\u5e76\u67e5\u770b\u8f93\u51fa\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5728 C# \u4e2d\u8c03\u7528 Python 3 \u7a0b\u5e8f\u65f6\uff0c\u5982\u4f55\u907f\u514d\u521b\u5efa\u65b0\u7a97\u53e3\u5e76\u67e5\u770b\u8f93\u51fa\uff1f<\/h1>\n<p>\u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6587\u7ae0\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u5728 C# \u4e2d\u8c03\u7528 Python 3 \u7a0b\u5e8f\u65f6\uff0c\u5982\u4f55\u907f\u514d\u521b\u5efa\u65b0\u7a97\u53e3\u5e76\u67e5\u770b\u8f93\u51fa\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241128\/1732794871674859f748f07.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5982\u4f55\u8c03\u7528 python 3 \u7a0b\u5e8f\uff1f<\/strong><\/p>\n<p>\u5728 c# \u4e2d\u8c03\u7528 python 3 \u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7 processstartinfo \u7c7b\u6765\u914d\u7f6e\u542f\u52a8\u4fe1\u606f\u3002\u4e3a\u4e86\u907f\u514d\u521b\u5efa\u4e00\u4e2a\u65b0\u7a97\u53e3\uff0c\u53ef\u4ee5\u5c06 createnowindow \u5c5e\u6027\u8bbe\u7f6e\u4e3a true\u3002<\/p>\n<p><strong>\u7136\u800c\uff0c\u60a8\u5f53\u524d\u7684\u4ee3\u7801\u4e2d\u5b58\u5728\u4e00\u4e2a\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u60a8\u5df2\u5c06 createnowindow \u5c5e\u6027\u8bbe\u7f6e\u4e3a true\uff0c\u5bfc\u81f4\u7a0b\u5e8f\u4ee5\u9759\u9ed8\u6a21\u5f0f\u8fd0\u884c\u800c\u6ca1\u6709\u521b\u5efa\u53ef\u89c1\u7a97\u53e3\u3002\u56e0\u6b64\uff0c\u60a8\u770b\u4e0d\u5230\u4efb\u4f55\u8f93\u51fa\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u5c06 createnowindow \u5c5e\u6027\u8bbe\u7f6e\u4e3a false\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>ProcessStartInfo p = new ProcessStartInfo(\"python\");\np.Arguments = \"my_python_script.py\";\np.CreateNoWindow = false;\nProcess.Start(p);<\/pre>\n<p>\u8fd9\u6837\uff0c\u65b0\u7a97\u53e3\u5c06\u88ab\u521b\u5efa\uff0c\u60a8\u5c31\u53ef\u4ee5\u770b\u5230\u7a0b\u5e8f\u7684\u8f93\u51fa\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8e\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300a\u5728 C# \u4e2d\u8c03\u7528 Python 3 \u7a0b\u5e8f\u65f6\uff0c\u5982\u4f55\u907f\u514d\u521b\u5efa\u65b0\u7a97\u53e3\u5e76\u67e5\u770b\u8f93\u51fa\uff1f\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 C# \u4e2d\u8c03\u7528 Python &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205314","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205314"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205314\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}