{"id":6425,"date":"2023-09-26T12:18:44","date_gmt":"2023-09-26T04:18:44","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=6425"},"modified":"2023-09-26T12:18:44","modified_gmt":"2023-09-26T04:18:44","slug":"ironpython-%e6%89%93%e5%8c%85exe%e6%9c%89%e9%82%a3%e5%87%a0%e4%b8%aa%e6%ad%a5%e9%aa%a4%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/09\/26\/ironpython-%e6%89%93%e5%8c%85exe%e6%9c%89%e9%82%a3%e5%87%a0%e4%b8%aa%e6%ad%a5%e9%aa%a4%ef%bc%9f\/","title":{"rendered":"ironpython \u6253\u5305exe\u6709\u90a3\u51e0\u4e2a\u6b65\u9aa4\uff1f"},"content":{"rendered":"

IronPython \u662f\u4e00\u4e2a\u5f00\u6e90\u5b9e\u73b0\u7684 Python \u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u662f\u57fa\u4e8e .NET Framework\uff08\u73b0\u5df2\u517c\u5bb9 .NET Core\uff09\u5f00\u53d1\u7684\uff0c\u8fd9\u4f7f\u5f97\u5b83\u5728 Windo\u9879\u76ee\u6253\u5305\u5de5\u5177<\/a>ws \u5e73\u53f0\u4e0b\u8fd0\u884c\u5f97\u975e\u5e38\u987a\u7545\uff0c\u800c\u4e14\u8fd8\u80fd\u5f88\u597d\u5730\u4e0e\u5176\u4ed6\u57fa\u4e8e .NET Framework \u7684\u7a0b\u5e8f\u548c\u7ec4\u4ef6\u8fdb\u884c\u96c6\u6210\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5c06\u4f60\u7528 IronPython \u5f00\u53d1\u7684\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe \u6587\u4ef6\uff09\uff0c\u4ee5\u4fbf\u5728\u6ca1\u6709\u5b89\u88c5 IronPython \u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u5b9e\u73b0\u3002<\/p>\n

\u539f\u7406:<\/p>\n

\u6253\u5305 IronPython \u7a0b\u5e8f\u4e3a\u53ef\u6267\u884c\u6587\u4ef6 (exe) \u7684\u539f\u7406\u5c31\u662f\u5c06\u4f60\u7684 Python \u811a\u672c\u3001IronPython \u89e3\u91ca\u5668\u4ee5\u53ca\u76f8\u5173\u7684\u5e93\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5f53\u8fd9\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u8fd0\u884c\u65f6\uff0c\u5b83\u4f1a\u81ea\u52a8\u52a0\u8f7d IronPython \u89e3\u91ca\u5668\u5e76\u8fd0\u884c\u4f60\u7684 Python \u811a\u672c\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\u7684\u8ba1\u7b97\u673a\u65e0\u9700\u5b89\u88c5 IronPython \u73af\u5883\u6216\u5176\u4ed6\u4f9d\u8d56\u5e93\u3002\u901a\u5e38\u6211\u4eec\u4f7f\u7528 pyc.py \u5de5\u5177\u6765\u6253\u5305 IronPython \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u8be6\u7ec6\u4ecb\u7ecd:<\/p>\n

\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

1. \u5b89\u88c5 IronPython<\/p>\n

\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b89\u88c5 IronPython \u73af\u5883\u3002\u8bbf\u95ee IronPython \u7684\u5b98\u65b9\u7f51\u7ad9 (https:\/\/ironpython.net\/) \u4e0b\u8f7d\u5b89\u88c5\u3002 \u70b9\u51fb “Download”\uff0c\u7136\u540e\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\u5b89\u88c5\u3002\u5b8c\u6210\u5b89\u88c5\u540e\uff0c\u8bf7\u786e\u4fdd\u5c06 IronPython<\/p>\n

<\/figure>\n<\/p>\n

\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684 PATH \u53d8\u91cf\u4e2d\u3002<\/p>\n

2. \u7f16\u5199\u4f60\u7684 IronPython \u7a0b\u5e8f<\/p>\n

\u6211\u4eec\u5047\u8bbe\u4f60\u5df2\u7ecf\u4f7f\u7528 IronPython \u7f16\u5199\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u7a0b\u5e8f\uff0c\u4f8b\u5982 hello.py\uff1a<\/p>\n

“`python<\/p>\n

print(“Hello, IronPython!”)<\/p>\n

“`<\/p>\n

3. \u4f7f\u7528 pyc.py \u5de5\u5177\u6253\u5305\u5e94\u7528\u7a0b\u5e8f<\/p>\n

\u8fd0\u884c\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u7136\u540e\u8fdb\u5165\u5305\u542b hello.py \u6587\u4ef6\u7684\u76ee\u5f55\u3002python \u6253\u5305\u751f\u6210exe<\/a>\u5728\u8be5\u76ee\u5f55\u4e0b\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n

“`<\/p>\n

ipy pyc.py \/main:hello.py \/target:exe<\/p>\n

“`<\/p>\n

\u6ce8\u610f\uff1a\u5982\u679c\u6ca1\u6709 pyc.py\uff0c\u53ef\u4ee5\u5728 IronPython \u5b98\u65b9 GitHub \u4ed3\u5e93\u627e\u5230\uff1a https:\/\/github.com\/IronLanguages\/ironpython2\/blob\/master\/Src\/Tools\/Scripts\/pyc.py<\/p>\n

\u8fd9\u4e2a\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u5c06 hello.py \u6253\u5305\u6210\u540d\u4e3a hello.exe \u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\/main \u53c2\u6570\u6307\u5b9a\u4e3b\u7a0b\u5e8f\u6587\u4ef6\uff0c\/target \u53c2\u6570\u6307\u5b9a\u8f93\u51fa\u7684\u76ee\u6807\u7c7b\u578b\u3002\u786e\u4fdd\u5728\u751f\u6210\u7684 exe \u6587\u4ef6\u4e2d\u5305\u542b\u6240\u9700\u7684 IronPython.dll \u548c Microsoft.scripting.dll\u3002\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5728\u4e0d\u5b89\u88c5 IronPython \u7684\u73af\u5883\u4e0b\u8fd0\u884c\u6b64\u53ef\u6267\u884c\u6587\u4ef6\u4e86\u3002<\/p>\n

\u73b0\u5728\uff0c\u4f60\u5c31\u53ef\u4ee5\u5c06\u751f\u6210\u7684 hello.exe \u6587\u4ef6\u53d1\u9001\u7ed9\u5176\u4ed6\u4eba\uff0c\u8ba9\u4ed6\u4eec\u5728\u4e0d\u5b89\u88c5 IronPython \u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u6b64\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

IronPython \u662f\u4e00\u4e2a\u5f00\u6e90\u5b9e\u73b0\u7684 Python \u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u662f\u57fa\u4e8e .NET Framework\uff08\u73b0\u5df2\u517c\u5bb9 .NET Core\uff09\u5f00\u53d1\u7684\uff0c\u8fd9\u4f7f\u5f97\u5b83\u5728 Windows \u5e73\u53f0\u4e0b\u8fd0\u884c\u5f97\u975e\u5e38\u987a\u7545\uff0c\u800c\u4e14\u8fd8<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[11598,11597,24,12,34],"topic":[],"class_list":["post-6425","post","type-post","status-publish","format-standard","hentry","category-zhuomianruanjian","tag-vs2015exe","tag-windowsiso","tag-24","tag-12","tag-34"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/6425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=6425"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/6425\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=6425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=6425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=6425"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=6425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}