{"id":6428,"date":"2023-09-26T12:18:44","date_gmt":"2023-09-26T04:18:44","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=6428"},"modified":"2023-09-26T12:18:44","modified_gmt":"2023-09-26T04:18:44","slug":"ironpython%e6%89%93%e5%8c%85exe%e6%b6%89%e5%8f%8a%e5%93%aa%e4%ba%9b%e6%8a%80%e6%9c%af%e5%8e%9f%e7%90%86%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/09\/26\/ironpython%e6%89%93%e5%8c%85exe%e6%b6%89%e5%8f%8a%e5%93%aa%e4%ba%9b%e6%8a%80%e6%9c%af%e5%8e%9f%e7%90%86%ef%bc%9f\/","title":{"rendered":"ironpython\u6253\u5305exe\u6d89\u53ca\u54ea\u4e9b\u6280\u672f\u539f\u7406\uff1f"},"content":{"rendered":"

\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5c06IronPython\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\u3002\u8fd9\u5bf9\u4e8e\u90a3\u4e9b\u9700\u8981\u5c06\u60a8\u7684Python\u811a\u672c\u5206\u53d1\u7ed9\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u7528\u6237\u975e\u5e38\u6709\u7528\u3002<\/p>\n

IronPython\u662f\u4e00\u4e2a\u5f00\u6e90\u5b9e\u73b0\u7684Python\u7f16\u7a0b\u8bed\u8a00\uff0c\u9488\u5bf9.NET\u6846\u67b6\u8fdb\u884c\u4e86\u4f18\u5316\u3002IronPython\u6709\u52a9\u4e8e\u5c06Python\u4e0e.NET\u96c6\u6210\uff0c\u5e76\u5141\u8bb8\u4f7f\u7528Python\u811a\u672c\u8bbf\u95ee.NET\u5e93\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528IronPython\u914d\u5408\u4e00\u4e9b\u5de5\u5177\uff08\u5982py2exe\uff0cpynsist\u7b49\uff09\u5c06Python\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n

\u4ee5\u4e0b\u662f\u5c06IronPython\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8fc7\u7a0b\uff1a<\/p>\n

1. \u5b89\u88c5IronPython<\/p>\n

\u8981\u4f7f\u7528IronPython\uff0c\u9996\u5148\u9700\u8981\u5728\u60a8\u7684\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u5b83\u3002\u8bbf\u95eeIronPython\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762(https:\/\/ironpython.net\/download\/)\uff0c\u5e76\u6839\u636e\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u9009\u62e9\u9002\u5f53\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\u6309\u7167\u5b89\u88c5\u7a0b\u5e8f\u7684\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\u3002<\/p>\n

2. \u7f16\u5199IronPython\u811a\u672c<\/p>\n

\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684IronPython\u811a\u672c\u4f5c\u4e3a\u793a\u4f8b\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a”helloworld.py”\u7684\u6587\u4ef6\uff0c\u5176\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

“`python<\/p>\n

import clr<\/p>\n

from System import Console<\/p>\n

Console.WriteLine(“Hello, world!”)<\/p>\n

“`<\/p>\n

\u6b64\u793a\u4f8b\u811a\u672c\u4f7f\u7528IronPython\u4e2d\u53ef\u7528\u7684.NET\u5e93System\u6253\u5370\u201cHello, World!\u201d\u3002<\/p>\n

3. \u5b89\u88c5py2exe<\/p>\n

py2exe\u662f\u4e00\u4e2a\u7528\u4e8e\u5c06Python\u811a\u672c\u8f6c\u6362\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\u7684Python\u6269\u5c55\u3002\u4f7f\u7528`pip install py2exe`\u547d\u4ee4\u5b89\u88c5py2exe\u3002<\/p>\n

4. \u521b\u684c\u9762\u5e94\u7528\u5f00\u53d1<\/a>\u5efasetup.py\u6587\u4ef6<\/p>\n

\u5728\u60a8\u7684IronPython\u811a\u672c\u6240\u5728\u76ee\u5f55\u4e2d\u521b\u5efa\u540d\u4e3a\u201csetup.py\u201d\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n

“`python<\/p>\n

from distutils.core import setup<\/p>\n

import py2exe<\/p>\n

setup(<\/p>\n

console=[‘helloworld.py’],<\/p>\n

options={<\/p>\n

“py2exe”: {<\/p>\n

“includes”: [“System”]<\/p>\n

}<\/p>\n

}<\/p>\n

)<\/p>\n

“`<\/p>\n

5. \u4f7f\u7528IronPython\u7f16\u8bd1\u5668\u7f16\u8bd1\u811a\u672c<\/p>\n

\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u6216\u7ec8\u7aef\uff09\uff0c\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`bash<\/p>\n

ipy64.exe setup.py py2exe<\/p>\n

“`<\/p>\n

\u8fd9\u4f1a\u4f7f\u7528IronPython\u7f16\u8bd1\u5668\uff08ipy64.exe\uff09\u548csetup.py\u811a\u672c\u5c06”helloworld.py”\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002ipy64.exe\u9002\u7528\u4e8e64\u4f4d\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f32\u4f4d\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8bf7\u6539\u7528ipy.exe\u3002<\/p>\n

6. \u67e5\u627e\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n

\u5728\u9879\u76ee\u7684\u76ee\u5f55\u4e2d\uff0c\u60a8\u4f1a\u53d1\u73b0\u4e00\u4e2a\u540d\u4e3a\u201cdist\u201d\u7684\u65b0\u6587\u4ef6\u5939\u3002\u5728\u8be5\u6587\u4ef6\u5939\u4e0b\uff0c\u5c06\u627e\u5230\u540d\u4e3a\u201chelloworld.exe\u201d\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u53cc\u51fb\u8be5\u6587\u4ef6\u4ee5\u6267\u884c\u7f16\u8bd1\u540e\u7684IronPython\u811a\u672c\u3002<\/p>\n

\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u5e94\u8be5\u53ef\u4ee5\u5728\u6ca1\u6709Python\u73af\u5883\u7684\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002<\/p>\n

\u603b\u4e4b\uff0c\u8fd9\u5c31\u662f\u5982\u4f55\u4f7f\u7528IronPython\u5c06Pyth\u524d\u7aef\u6253\u5305exe\u5de5\u5177<\/a>on\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u7684\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u66f4\u590d\u6742\u7684\u793a\u4f8b\u6765\u5145\u5206\u53d1\u6325IronPython\u4e0e.NET\u96c6\u6210\u7684\u5de8\u5927\u6f5c\u529b\u3002\u8fd9\u79cd\u96c6\u6210\u4e0d\u4ec5\u589e\u5f3a\u4e86Python\u811a\u672c\u7684\u529f\u80fd\uff0c\u8fd8\u4f7f\u5176\u66f4\u5bb9<\/p>\n

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

\u6613\u5728Windows\u73af\u5883\u4e2d\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5c06IronPython\u811a\u672c\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\u3002\u8fd9\u5bf9\u4e8e\u90a3\u4e9b\u9700\u8981\u5c06\u60a8\u7684Python\u811a\u672c\u5206\u53d1\u7ed9\u6ca1\u6709\u5b89\u88c5Python\u73af\u5883\u7684\u7528\u6237\u975e\u5e38\u6709\u7528\u3002IronPython\u662f\u4e00\u4e2a\u5f00\u6e90\u5b9e\u73b0<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[11602,24,11601,241,2306],"topic":[],"class_list":["post-6428","post","type-post","status-publish","format-standard","hentry","category-zhuomianruanjian","tag-winformexe","tag-24","tag-exe","tag-241","tag-2306"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/6428","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=6428"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/6428\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=6428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=6428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=6428"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=6428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}