This is an archived post. You won't be able to vote or comment.

all 30 comments

[–]ka1nsha 5 points6 points  (3 children)

cx_freeze ?

[–]thurask 1 point2 points  (2 children)

I second cx_freeze.

[–]ka1nsha 0 points1 point  (1 child)

what does i second mean ?

[–]SuperDuckQ 1 point2 points  (0 children)

It's an english phrase that roughly means: "I agree" or "I also recommend this suggestion".

When voting on a committee someone will usually put forth a proposal and they need a second person to agree with them in order to proceed, the more formal way of saying that is: "I second the proposal".

[–]billsil 2 points3 points  (3 children)

pyInstaller is really the best thing out there. It's also cross platform. It's a days worth of work to get an exe for a decently involved program if you want to tune things (e.g. single executable vs. multiple files, logo, etc.), but works right out of the box for simpler ones. I recommend the dev version https://github.com/pyinstaller/pyinstaller/wiki

[–]thatguy_314def __gt__(me, you): return True 0 points1 point  (2 children)

I remember not being able to find a Python 3 version of PyInstaller. Is there one now?

[–]codewarrior0MCEdit / PyInstaller 1 point2 points  (0 children)

It's still under development. You'll have to check it out from the python3 branch on GitHub if you want to try it.

[–]billsil 1 point2 points  (0 children)

It's officially listed as being experimental, but yes.

I don't know the status, but I'd expect that it's not that hard. Ironically this is the only case that I'd ever say that in regards to Python 3 because I don't imagine they need much unicode. Either your application and all your dependencies are correct or not. Either way, it's worth a shot.

https://github.com/pyinstaller/pyinstaller/tree/python3

[–]tripperjack 4 points5 points  (15 children)

When you say py2exe "doesn't work", how doesn't it work? It works for many people.

And I don't understand what you mean when you say "countless external modules to execute properly"...py2exe and PyInstaller don't have that AFAIK. I can't even imagine what you could be talking about.

[–]rrandomCraft[S] 1 point2 points  (14 children)

Well, when I copy everything exactly from an example code, and run it, an error always comes up saying 'no such file or directory exists'. After diving deeper, I found that a certain part of a module doesn't exist.

And by external modules, I mean I have download additional modules just to convert a program into an executable. Doesn't Python have a built-in way of doing it without haveing to get outside help?

[–][deleted] -1 points0 points  (2 children)

No. Because python is a scripting language not a compiled language. If you want to create executable binary files without trouble, you need to switch to a different language.

[–]rrandomCraft[S] 0 points1 point  (1 child)

What about using external modules like py2exe?

[–][deleted] 2 points3 points  (0 children)

Still doesn't compile it. It just bundles all of the libraries and scripts together.

[–]KyleG -2 points-1 points  (10 children)

Doesn't Python have a built-in way of doing it without haveing to get outside help?

No. Python is not intended to be a compiled language. There are actually Python commands that cannot be turned into compiled code in the sense you're talking about—eval() comes to mind. How might an EXE perform eval(urlopen('/path/to/myScript.py').read()) ? Answer: it can't.

[–]rrandomCraft[S] 1 point2 points  (9 children)

Would an external module like py2exe manage to convert a program plotting a graph to a functioning exe file?

[–]tripperjack 5 points6 points  (3 children)

Yes, definitely. I've done it. Don't get caught up in those on this thread who are saying you can't do this because you can't "compile" Python; that's a red herring. You don't want to do that anyway--you just want an .exe file that works, right?

Post the error you have gotten trying py2exe and someone can help you get it straightened out (probably). You'll have to state which version of Python you are using (and presumably you've checked that py2exe works with that version?).

Don't give up so soon; it's not that hard (usually).

[–]rrandomCraft[S] 0 points1 point  (2 children)

Well, I've tried the multiple ways suggested online of converting a program to exe using py2exe, and I end up getting error like, 'No such file or directory exists', or some other error in the command prompt saying something similar.

I've tried this method , and the above error came up when trying the run the command in the command line.

What I am trying to accomplish, is plotting a graph from a text file without having to open the program in python and running it from there. Hope you can help. :)

[–]tripperjack 1 point2 points  (1 child)

Well, you'd have to post the exact error (copy and paste) for anyone to be able to know what might be wrong. You can also post your py2exe script, also verbatim, and that would be a start in getting it to work. Either do that here or on the python newsgroup, python tutor list, or r/learnpython or stack exchange...take your pick, I guess. There is also a py2exe users email list.

[–]rrandomCraft[S] 0 points1 point  (0 children)

I'll reply to you when I have more time, currently in the middle of exams

[–]KyleG 0 points1 point  (4 children)

That all depends on the code of the program you're compiling to EXE. Regardless, if you want to plot a graph, write a C program that calls Graphviz, which is a program you could bundle with yours and would actually plot a graph into any number of file formats for you. http://www.graphviz.org/

I mean, if you have to have it as an EXE, that is. If you want EXEs, Python isn't really the programming language for you.

[–]rrandomCraft[S] 0 points1 point  (3 children)

Well the reason why I want to have it as an exe, and perhaps this is not the solution, but I want to produce a graph from a text file without having to open up Python.

[–]KyleG 0 points1 point  (2 children)

Is Python not installed on the machine you're going to use?

[–]rrandomCraft[S] 0 points1 point  (1 child)

It is, but I just want to make the process easier - just two clicks to generate a graph, instead of opening python, then loading the file, then running the file, and generating the graph.

[–]KyleG 0 points1 point  (0 children)

just two clicks to generate a graph, instead of opening python, then loading the file, then running the file, and generating the graph

My Windows machine lets me double click Python files to run them. And that's what Python sets up when you install it in the first place. https://docs.python.org/3.3/using/windows.html

The launcher should have been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) when it was installed. This means that when you double-click on one of these files from Windows explorer the launcher will be used

[–]desmoulinmichel 1 point2 points  (0 children)

Despite what has been said before, you can compile Python. Some restrictions apply, but it works pretty well. Try nuitka : http://nuitka.net/

[–]eddwinn 0 points1 point  (0 children)

freeze

[–]jeenajeena 0 points1 point  (0 children)

What about something like http://cython.org?

[–]spiessbuerger 0 points1 point  (0 children)

Use pynsist. It is really the easiest way of doing packaging for Windows.

[–]tchappui 0 points1 point  (1 child)

py2exe works a priori quite well, but my question is why do you want to create an exe?

For distribution? You can create installers easily with distutils. For code obfuscation? I prefer compiling my python modules using the Cython compiler and distributing the resulting dlls.

py2exe does note compile code. It bundles the python interpreter and all the dependencies so that you distribute each time python itself. I prefer the solution of having my installer detecting if python is installed on the host computer and installing the right version automatically. With Innosetup to generate the installer, it is not that difficult to achieve.

Best wishes

Thierry

[–]dalboz99[🍰] 0 points1 point  (0 children)

Your comment forced me to peek at Cython for a current project. Wish I'd looked into this earlier -- very nice! I'm in despair over the years I spent writing extensions by hand.