cx_Freeze - like py2exe but supports Python 3: http://cx-freeze.sourceforge.net/
EDIT: cx_Freeze collects all the files you need to run a program, and makes an exe to start it. You can distribute them in a zip file, or it can make an MSI installer for you. It doesn't have a single-file exe mode, though.
Kudos for working on this, I think it's really valuable to have more people thinking about ways to distribute applications.
However, from my experience working on cx_Freeze, there are quite a lot of packages which don't like being loaded from zip files. That starts with compiled extension modules - does exxo have any way to handle these? - but even among pure Python packages, there are many that don't work from a zip file. We had problems with requests
, for instance.
Because of the large ecosystem of packages like this, I think that the only reliable way to run Python applications is with a real directory structure of multiple packages, even if that's unpacked at runtime into a temporary directory. I agree that Go's single-binary approach is nice, but Go was designed from the start to work like that, and Python definitely wasn't.
I maintain a tool called Pynsist to build Windows installers for Python applications, and this was one of the key principles I followed when designing it: the installer itself is one file, but what it installs is a directory with many files.
I think the primary issue for Linux is the lack of a decent common application packaging format. I had a go at a solution for that too, but I couldn't convince many people it was a problem that needed solving.
No, there are methods to compile the game into a standalone executable, like cx_Freeze.
Note to everyone: SourceForge is under new management that has done away with all the terrible practices associated with its previous owner/iteration.
I use cx_freeze: http://cx-freeze.sourceforge.net/. I have had good experience in deploying it on various Windows 7 machines.
It is supposed to work for Linux as well, but I have not had a reason to try that out.
I think you should take a look at cx_Freeze.
http://cx-freeze.sourceforge.net/index.html
http://cx-freeze.readthedocs.org/en/latest/index.html
[Edit]: What is it with people in this thread? Almost everything is down-voted to -1...
>How would one go on about making exe of something done with Python 3.3 or am I forced to use earlier version of Python
Cxfreeze
http://cx-freeze.sourceforge.net/
>And how troublesome is it in general to build standalone programs from your scripts?
It's simply not designed to do that because it's an interpreted language. This functionality is hacked on by cxfreeze, pyinstaller, py2exe, etc etc. Typically compiled python is just a .pyc file which still needs an interpreter. These extra programs that create .exes bundle the nessesary parts of the interpreter into a folder with the .exe file so that it can be run on a box without an interpreter installed.
So when you distribute your python app, you shouldn't be doing it by getting pip to place your dependencies locally..
Either you distribute your script alone which would require the person that wants to run it to install python and the dependencies. That's only really used when your sharing it with another developer
Or you want to distribute it as an executable file, in which case you use something like cx_freeze to create the exe or your platform specific executable
Feel free to respond to this with any questions you have for a quick response.
I'd first try out hy2py and then cx_freeze. It's unclear whether py2exe can create an executable from the pyc files that will be outputted from hy2py.
That doesn't solve the last three points, however. My suggestion would be to write/find a virtual terminal library. It's not terribly hard and you could use it just for the windows port.
http://cx-freeze.sourceforge.net/. Py2exe is out there but can be a little more complicated as it will have you packaging the C++ files used to make python into a build script.
Pyinstaller is also really good but only works on python 2 as far as I know.
You can execute your .jar
file anywhere where Java is installed. Java just happens to be installed on most computers. You can similarly build a one-file distribution of your Python application that will run anywhere where Python is installed. You can even use cx_Freeze to build an executable that bundles your code and the Python interpreter, so if the end user downloads that and runs it with ./program
, they'll have your code running even if they don't have Python installed.
Edit: cx_Freeze tutorial.
Indeed. I really prefer cx_freeze, as it supports Python 3 (Py2exe is dicontinued). It's easy to use, multiplatform, and really good (but not perfect) at finding files referred to in the script. http://cx-freeze.sourceforge.net/.
Ah no Linux support, hmm... I found cx_Freeze through some Googling on "py2exe linux", maybe that helps.
Otherwise, good luck with your own coding. It sounds like you'll sort it out. :)
Here's a walk-through I wrote for using py2exe to create a Windows executable from Python code. If you're on Linux/Mac, you can use cx_freeze.
> Distribution is unwieldy, and unless your audience have Python and pygame installed you'll need to get to grips with complex tools like py2exe, which i personally have totally failed to successfully export any my games with in the past. Also, unlike Flash and Unity there is no web player so users will have to download your game, significantly reducing your potential player numbers.
I've had good success with cx_Freeze for building Windows executables for pygame + Python 3.3. I have to copy over my subfolders for things like graphics and audio, and the ogg lib SDL uses (libvorbis.dll, I think?), but other than that it is pretty simple. Additionally, if you use the font module you might have to copy a font file over into the library.zip file (inside its pygame folder, if I recall) that cx_Freeze will create. This might be true only with the default system font pygame uses--I am unsure because I don't use the bundled font module anymore.
You can use something like cx_freeze to create Python executables and then you don't have to worry about the consumer installing the right libraries to use your application.
hmmm If you have it installed, it should exists in your python path so import rlfl should work. As it is I have no access to a windows machine so I cant test it. I also must admit I am not familiar with how python works on windows.
If you mean you want a library shipped with your code things like cx_freeze should pull inn all dependencies when making an exe file for you.
Analyzing thurask
New Quizzybot Game! Win Reddit Gold!
Is there a filesize limit? If not, you can freeze your python installation together with the game files using cx_Freeze (http://cx-freeze.sourceforge.net/) and distribute the resulting directory (including the executable file) to your teacher. In my experience, the freezing process adds ~10 mbs to the total size of the game with python 3.2, in addition to the size of whatever game-related files you have, and any library dependencies (besides pygame) outside of the standard python package you include.
In order to use cx_freeze to build your game, you'll need to create a simple setup.py file which tells cx_freeze how to build your game and what non-standard packages to include/exclude. have a look here for more info on creating and running your setup file: http://cx-freeze.readthedocs.io/en/latest/distutils.html
Although it is not required, you may also want to compile all of your game code to .pyc files during the build process, as otherwise your game will have to do this at runtime when it is first executed. You can do this recursively using the compileall library (https://docs.python.org/2/library/compileall.html). Just be sure to leave the .py files as well if your teacher is looking for the source code to be included!
EDIT: Almost forgot, if you make use of the default pygame font (freeSansBold) in your game, you'll need to manually copy freesansbold.tff from pythonDirectory\Lib\site-packages\pygame to buildDirectory\library.zip\pygame In order for the executable file to work properly
Hold on let me check...
[...]
It doesn't really work, not without some tinkering. A lot of stuff seem really hard-coded (e.g. it's only working for 3.3 and 3.4, and it files for 3.3 and 3.4, 64-bit and 32-bit in all installations, i.e. in my 3.5 64 bit installation I have files for 3.3 32-bit, 3.3 64-bit, 3.4 32-bit and 3.4 64-bit, but none for 3.5 64 bit :))
Still, the whole project is just about abandoned. The last time there was any kind of commit was almost two years ago. The author also doesn't seem to understand how subversion is supposed to work. Why not use cx_freeze instead?
Also, I think with Python 3.5 you can run a zip file directly, but I haven't seen any freezing program (such as cx-freeze, pyinstaller or py2exe) that uses that feature.
Anyway, you may as well download Python 3.4 instead. Personally I've only just about scraped the surface of the new 3.5 features, so I don't think there's going to be a problem.
Analyzing thurask
trust score 99.5% ^tell ^them ^your ^secrets!
Fun facts about thurask
PyGame is just a wrapper over SDL. It's absolutely fine for a 2D game. Use cx_Freeze to distribute binaries.
All of Christine Love's games use Ren'Py, which is a visual novel engine built on PyGame.
There are a few packages that will bundle all your Python files and resources to run as an EXE. I have not tried any of them, nor do I know if any are compatible with the 3.x version.
EDIT: it appears cx_freeze works with Python 3.x. I will see if I can get it working for me so I may assist other as well.