{"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