I created an IronPython script that imports from Python libraries, such as os, sys, etc. as well as .NET libraries.
It runs perfectly fine from my Visual Studio IronPython solution but I need to deploy this so other people who don't have IronPython or Python installed can run it.
How would I do that?
Requirements:
ipy.exeinC:\Program Files (x86)\IronPython 2.7.1\pyc.pyinC:\Program Files (x86)\IronPython 2.7.1\Tools\Scripts\MyProgram.pywould be your program.MyProgram.pyis), create a folder called "deploy."cd deployin the command prompt."C:\Program Files (x86)\IronPython 2.7.1\ipy.exe" "C:\Program Files (x86)\IronPython 2.7.1\Tools\Scripts\pyc.py" /main:..\MyProgram.py /target:exeThis will generate a dll and an exe for MyProgram in the
deployfolder.If you try to run
MyProgram.exeand you're importing libraries likeos, you may get aNo module named ....Since, I'm using
os, I get this error:If you run "MyProgram.exe" and you're using standard libraries, you might get
No module named...errors.In my case, I got:
To fix this issue, copy
Libfolder fromC:\Program Files (x86)\IronPython 2.7.1\to thedeployfolder you just created. Then, before you import the libraries which are throwing errors, modifyMyProgram.pylike this:As a last step, copy the following files from
C:\Program Files (x86)\IronPython 2.7.1\todeployfolder as well:-
IronPython.dll-
IronPython.Modules.dll-
Microsoft.Dynamic.dll-
Microsoft.Scripting.dllNow you can zip up your
deployfolder and and ship it!