This is a common need. The simple answer is, you require your friend to have installed Python and all the libraries you use. Then you just send the script.py file. Works for good friends. But if you want to distribute your code to the world in general, where you can't expect the user to have all the dependencies (that's the proper term) the program needs, you have to bundle it as a self-contained program. Here are some well-known packages that do this:
PyInstaller: http://www.pyinstaller.org/
CxFreeze: https://cx-freeze.readthedocs.io/en/latest/
py2exe: http://py2exe.org/ (for Mac, see py2app)
Try Pyinstaller instead: http://www.pyinstaller.org/
Its function is similar to py2exe but it also generates Mac OS X and Linux binaries.
See: http://www.pyinstaller.org/wiki/SupportedPackages -- Note: wxPython is supported.
Basically, Calibre distributes the python runtime that it uses with the application, along with the libraries it uses locally. It's effectively installing a private version of python (or at least, as subset of it) alongside itself.
There are a few tools that'll do this process for you, such as py2exe or pyinstaller.
Oh! I think I see where your confusion is coming from. Hopefully I can clear it up.
Yes you can create everything you need from PyCharm. You can use pyinstaller to package it up into an exe, and then you can use something like Inno Setup to create a single .exe to install on Windows. Once all that is done correctly, to your user it'll look just like any other program. It'll download a single installer package and once they run that setup, it'll unpack your program and make shortcuts and all that jazz (based on how you setup the installer).
Creating the interface is just more lines of code. There is no "designer", you just write the code to make a window, write the code to make a button, etc. So as long as you have the correct libraries included (ex: import tkinter
) then you can write it all there. As far as "designing" the interface, that's all done in code. By default in tkinter each element is just in a vertical column, but with more fancy code you can create more intricate layouts as you need.
I've used PyInstaller with some success. One advantage is that you can build executables for Linux, Windows and Mac OS X with a single tool. Example: The logview application, which is a Qt-based viewer for logging events from the standard library logging package. Although I had to do a little extra work to build the .dmg on Mac OS X, PyInstaller got me to the point where I had a working app folder.
Generally, the user doesn't need to have Python installed in order to use a PyInstaller-built application.
AFAIK py2exe is Windows-only - you mentioned that you work on Linux, but are your users Windows-only?
From their site =):
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X. Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.2, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
The main goal of PyInstaller is to be compatible with 3rd-party packages out-of-the-box. This means that, with PyInstaller, all the required tricks to make external packages work are already integrated within PyInstaller itself so that there is no user intervention required. You'll never be required to look for tricks in wikis and apply custom modification to your files or your setup scripts. As an example, libraries like PyQt, Django or matplotlib are fully supported, without having to handle plugins or external data files manually.
Generally, you’d want to give them the python file and they’d have python installed. There are tools for this though.
It's not built in, and can be mighty fiddly at times, but pyInstaller does just that.
Combine with Inno Setup and you got something that's easily distributable and fairly professional looking
I'm assuming management is full of dingdongs that just want to click an executable and have it work.
First what you will want to do is integrate Gooey into your program. This will autogenerate a GUI for your application and will allow users to feed it the necessary input for the program to work. It requires very minimal effort to integrate. This post provides a good example of how to use Gooey.
Next you will want to bundle it all up into one executable. My recommendation is to use <code>pyinstaller</code>.
Do all of that for each script and hand management the executables. They'll be so amazed you might snag a raise.
Good luck!
IMHO, these two questions seem quite ~~irrelevant~~ unrelated.
On windows platform, I use PyCharm with multiple virtual environments, and Jupyter notebooks for data science projects. Sometimes VSCode (with Python extension) starts quick and helps me get things done.
For creating executable, I suggest you check out PyInstaller and py2exe. Both can take care of dependencies pretty well.
Use PyInstaller or Py2Exe depending on your needs. They're pretty simple to use. I use PyInstaller because Py2exe works only up to 3.4 I think
> PyInstaller hasn’t seen a release in the last 2 years; it doesn’t support Python 3.
You are quite wrong there! PyInstaller has supported Python3 for a year, and is in continuous development and is currently at version 3.1.
Get the current dev version,
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
which has a bunch of PyQt related fixes not in the pip install version.
I see this queestion a lot. I am not to this point yet, but these are the most common answers you will get:
edit: added links
cx_freeze hasn't seen a release in a year. I had troubles too. It also doesn't support Python 3.5
For now, I'd recommend pyinstaller which just had its 3.1(that's not a python version) release last week. (and which I use at work)
just
pip install pyinstaller
pyinstaller --onefile my_program.py
Which generates a single executable in a dist/ folder. Adding data files will require additional modification of the generated .spec file and recompilation with pyinstaller my_program.spec
.
Caveats: No cross-compiling and isn't compatible with older versions of GLIBC than the OS it's compiled with for linux.
> Creating and selling software with Python. Is this a viable business strategy?
Yes, it definitely is! However, here are some things to keep in mind when going this route:
Version
Use Python 3. This should be "obvious," but many tutorials out there are still aimed at Python 2. Additionally, many people on here still prefer Python 2. However, the reality is that support for Python 2 officially ends in 2020. So unless you need a module that is only supported on version 2, then use Python 3.
Graphical User Interface
Python comes with a standard GUI toolkit called tkinter, TkDocs is a good tutorial. Make sure to set "Python" as the language on that website as the examples there can be viewed in multiple languages. PyQT and PySide are two other GUI toolkits that support Python 3.
Distribution
Use tools like cx_Freeze and PyInstaller to create frozen/compiled executables for your programs. The advantage to this is that your users will not have to manually install Python themselves in order to use your applications.
Pyinstaller is a tool to generate bundles of your scripts. Last time I worked with it, it was tricky to get it to only make one executable with everything packaged into it. The end-user does not have to have Python installed.
Also, you can try Nuitka which is a Python compiler. The end-user has to have Python installed, unless you recurse everything as described in the docs. I haven‘t had any luck with Nuitka making completely stand-alone executables yet but maybe I am the one using it wrong.
The two before-mentioned are for deploying, so your code can be executed on a target computer. If however, the other person needs to modify the code, a virtual environment would be a choice. You can create one with python3 -m venv /path/to/new/virtual/environment
. The other person needs to have Python installed for this and if they already have Python installed, it should not be too much of a hassle to do a pip install
. On Linux the environments don’t work correctly if they are moved to a different path. I can’t say anything about the portability of those on other operating systems.
If you want to run the program as an executable on another computer, there are several programs to do this based on the target computer's OS.
Read up on plotting in pandas which is based on matplotlib.
Creating executable can be done with PyInstaller.
In regards to auto-updating - have you thought about using some web framework and publishing the data that way (with django/flask or something)? You wouldn't have to worry about old clients, updating, packaging the executable...
Try Pyinstaller
If you use frameworks (in my case it was PyQt) you may need to copy some of its dll-files to the "dist"-folder to make it executable on every machine.
There is also py2exe but I had some problem with this one.
Whenever I need to deploy python scripts for users who don't have access to their own python installation, I use PyInstaller with the -F flag to bundle all dependencies (including the interpreter) into a single .exe. You have to dig a little into the documentation to figure out how to do it, but I got it up and running in less than half a day, all told.
There is also py2exe, but I haven't personally tried that.
Other than that, you would need to install python on all machines the scripts are supposed to run on, make sure they have all the relevant libraries installed (if you use third party modules like numpy or flask), and familiarize managers with using Python scripts.
Personally, I'd prefer handing them executables.
If your friends already have Python, you can usually copy the extra modules into the same folder as your python script because the import lines will look in the local folder first. But that's not as elegant as packaging the whole thing into an .exe file with something like PyInstaller.
There's also Py2exe but it doesn't work very well on Win64 so I don't recommend it.
Matplotlib has a working but unreleased Python 3 branch that can be compiled.
For binary packaging, only cx_Freeze seems to have got there yet. PyInstaller has a ticket open, but it doesn't look like anyone's working on it.
Just to add to this, you link to py2exe, but pyinstaller is much better for the latest version of Python3. Py2exe doesn't support the latest Python3.6.
And while it probably wouldn't make sense to build hello world into an exe, it's always a better idea to provide a standalone exe to a user rather than requiring them to install Python.
Py2exe is not really maintained any more, as far as I know. Pyinstaller is a similar tool which is still maintained, so you might want to try that.
I make a tool called Pynsist which makes a Windows installer (not a standalone exe).
Sir.
Yes, you can run this script through CMD or Powershell, the only requirement is that you download Python 3.x.x. When you install Python, run "congen.py" in the command line at the script's directory to get started. And yes, you can compile it yourself: the way I did it was via pyinstaller (and you need to install Python to use it.)
Thanks for the heads-up regarding the AV warning; I'm building the application on a clean W10 machine, and also scanned the application with Windows Defender without detecting any threats.
I'm using PyInstaller to package the Python application as a stand alone executable, see this page and the repository at GitHub. I did a quick search and there have been several false positives related to PyInstaller packaged applications, see this link. Most replies from the PyInstaller team is that this is outside of their control and the AV manufacturer must be contacted to solve the problem.
This is of course annoying, and I have tried to build the executable with some other tools (Py2Exe and cx_freeze), but to my understanding these tools don't support Python 3.5 that I'm using.
I would appreciate any help on this topic, please let me know if anyone has some ideas...
Gooey is a good option to turn a simple command-line script into a GUI automagically. A combination of Gooey and pyinstaller or py2exe and boom, you have a standalone GUI ready for distribution in no time !
The process will be the same. I personally use Anaconda because it ensures all of the supplied packages are consistent on multiple platforms I develop for (e.g. Windows/OS X/Linux). If you're only developing for Windows, then there is no reason to switch from WinPython if it is working out for you.
I have used PyInstaller to create executables on both Windows and OS X, and Inno Setup to create an installer for Windows. At the time, PyInstaller was the only one I could successfully create an executable with my code, so I stuck with it.
Correct. You could also create a standalone executable from the Python sources (topblock.py) with PyInstaller (http://www.pyinstaller.org ) which works on Linux, OSX, and even Windows, although you would need GnuRadio on the latter.
Also note that Matlab isn't interpreted but compiled through a JIT. It's not as fast as C for instance, but still faster than something fully interpreted such as Octave.
Re. distributing desktop apps, I've found PyInstaller to work pretty well on Linux, OS X and Windows. For OS X, you need to do a little more work to get to a .dmg
, but it's quite doable. Example app here.
I'd actually suggest PyInstaller rather than py2exe - IME, it is more comprehensive, supports more use cases, and also supports compiling binaries for Linux and Mac OSX as well, so you can use a single build workflow to generate standalone binaries for all three platforms.
Edit: oops, forgot link: http://www.pyinstaller.org/
I'd recommend PyInstaller as your bundler and one of PyQt or wxPython, both are supported by PyInstaller. I haven't used PyQt much at all, but I can say from experience that PyInstaller + wxPython makes for a nearly painless Python application distribution.
You might check out something like http://www.pyinstaller.org/ which can compile it down to an executable. An expert can probably still figure it out but it deters casual inspection.
There's two parts to this (possibly three):
.exe
file which will look like they expect. To do this I'd recommend PyInstaller..exe
that someone would download which is one single file that upon running it, it'll walk the user through installing and setting up the software. It's responsible for moving the files to the correct locations, creating shortcuts in the start menu and/or desktop, creating the registry entries so it can be uninstalled via the OS etc. For this I'd recommend Inno Setup.Then you mentioned about making it easy to update. To do this you'll need to add code to your actual program itself to check for updates (you'll need some server that can be queried to see if there's a new version available) and then your program will also need to be able to download that same installer and run it all from within your program.
Great job and thanks for writing this up for the plasma desktop. Please think about adding a readme and if you do also think about adding screenshots of your tool, since most people want to see what the gui looks like.
You should package this up into a binary, you could use PyInstaller(which works great for QT apps too) for that to create a single file binary, or consider writing an install script.
You can use Django framework for Python, it can run on any desktop operating systems (FreeBSD, Linux, macOS, Solaris, Windows, etc,). Sublime Text is one of examples. But to compile to all operating systems, you must install firstly pip
, and run pip install
Nuitka and PyInstaller. Django and Python are free for commercial use.
I wouldn't mind taking a crack at it. My first thought when I saw this was "I want to code this".
If you would like to learn how to make a binary executable check out http://www.pyinstaller.org/. You can create executables for Mac and Linux as well with this.
There are many options available to you. I would suggest you look at PyInstaller and Nuitka.
Fundamentally the first is a bundler program that creates a frozen executable, which is basically an appropriately created zip file with a partial copy of Python embedded within it alongside your program and its dependencies. It works on Windows, Mac, and Linux (though it cannot cross-compile between them), but basically how it works is that when your frozen program is run it effectively unzips the file somewhere and pretends to run an exe while what it's actually doing is running Python and interpreting your code in much the same way that it would if you'd distributed the code as a .py file and relied on your users having a copy of Python at hand, ie by using pip. It works, it's not exactly simple but it is functional, and while the resulting files tend to be huge and their performance is slightly slower than running an un-bundled interpreter, it's about the easiest way to accomplish the goal, especially with non-pure-Python dependencies.
The latter is more interesting, but doesn't work for everything: it actually compiles your Python code into a native C executable that's linked against libpython. It also works on all three major OSs (though IIRC it also cannot cross-compile), but unlike PyInstaller if your program was pure Python to begin with there's a decent chance it will actually speed it all up. It's more complicated, has a different learning curve, and being newer doesn't have the history of tutorials out there, but it's very interesting, and the route I'd tend to go down, though with a chance that what you really need out of it might be some number of releases in the future.
http://www.pyinstaller.org/ maybe? I use it because py2exe gave me some issues. For example the modules in py2exe are in a ZIP file and you need to change the if you access to the path of the modules (or something like that, I don't remember). Pyinstaller does not need you to modify the source code of the script.
And if you use Pyinstaller, add some Setup.exe from http://nsis.sourceforge.net/ and you'll be the boss!
I made an executable that is a python GUI, takes in a CSV file of instructions, and automates whatever windows app in accordance to the CSV file. The dependencies used were PySide and http://www.pyinstaller.org/, and what that did was create a standalone .exe file that windows was able to run without any installation.
If you're a more web kind of guy, https://electron.atom.io/ works pretty well, and probably looks better and is easier to get your feet in the water (i remember i had to install a crap ton of dependencies just to get GUI in python to work).
Not sure which version of Python you're using, but one thing you can do is use Pyinstaller to distribute your script to Windows users, I believe. I haven't done any large-scale app building/distribution where a proper chain of events happens like with appveyor, but what I've done is whip up a script, mock something up in tkinter, and have Pyinstaller take care of the .exe part. I then just use inno setup to provide my users in the office with an installer.
YMMV, as my industry experience is limited and I'm just a lone dev at my company.
There is a specific PyInstaller mailing list, see http://www.pyinstaller.org/support.html for the address.
According to this page of the doc,
https://pyinstaller.readthedocs.io/en/stable/spec-files.html#giving-run-time-python-options
the only python run-time options supported are -u, -v, and -w, so not -O.
However, do ask it of the mailing list.
If your program uses nltk then they either need to get nltk themselves or you need to give it to them. If you're deploying to an OS that has a package manager then consider making a package and just have it list nltk as a dependency. Otherwise, you should probably look into using a "freezing" tool such as PyInstaller.
For item 3 you can package it with any number of programs, but my preferred is pyinstaller. It essentially creates an executable program and bundles python (and any dependencies like pandas) with it. It's been a bit since I've used it but it should be something like pyinstaller --onefile mainscript.py
To save them from having to find a few other utilities:
I have mostly loved using pyinstaller
, though I have heard cx_freeze does nicely too.
I would recommend packaging your app (and all its dependencies) into a nice standalone .exe file (and a binary for Linux) so that whomever you are handing the CD to would be able to run it without having to install python, virtualenv etc. Luckily there are various tools that can do that easily for python, such as http://www.py2exe.org/ and http://www.pyinstaller.org/.
I use http://www.pyinstaller.org/.
Steps:
python pyinstaller.py --name "NameOfMyProject" ..\project\main.py
Then, open the NameOfMyProject.spec inside the NameOfMyProject folder
In the COLLECT() part, you want to add a parameter called Tree('..\project')
Now you save this file, and run:
python pyinstaller.py NameOfMyProject\NameOfMyProject.spec
You wait a bit and your executable will be in the NameOfMyProject/dist/NameOfMyProject folder.
I hope this works! for you!
I'm not familiar with libtcod but that "Module Not Found" error you're getting reminds me of an issue I had with pyinstaller. The problem turned out to be with hidden imports, where pyinstaller isn't able to figure out what imports to include in some cases. The solution is to explicitly tell it to include the modules it can't find automatically. I'd recommend reading more about this in the pyinstaller manual:
> Hidden imports are fairly common. These can occur when the code is using __import__ (or, perhaps exec or eval), in which case you will see a warning in the warnproject.txt file. They can also occur when an extension module uses the Python/C API to do an import, in which case Analysis can't detect anything.
If you can then try and read the rest of the pyinstaller manual, it helped me a lot when I was struggling to get things working.
A lightweight relational database like SQLite or MySQL might work well for you. You can actually compile python files into executables using PyInstall.
If your target users are also Python users, then it is expected that you have install dependencies for new scripts. All you have to do is run pip freeze > requirements.txt
in your virtualenv, which will spit out a requirements file, which you bundle with your script. Anyone downloading it can then just pip install -r requirements.txt
to install all of the packages you have listed in your requirements file.
If your target users are not Python users then you may have to bundle your script along with the dependencies using something like http://www.pyinstaller.org/
Gordon McMillan - Wrote the old "Installer" package for packaging python scripts. Disappeared as far as I could tell, for the longest time his webpage (http://www.mcmillan-inc.com/install1.html) was down and eventually the code got resurrected here: http://www.pyinstaller.org/.
I found out a few more details using Wayback Engine:
There's also PyInstaller, which I can strongly recommend. It has good cross-platform support, and works amazingly well with 3rd party libs (if you have any). It's easy to use, and flexible enough to handle almost any distribution configuration.
For bundling Python scripts into an executable you can try PyInstaller. For making a graphical user interface that doesn't require users to use the command prompt, there are a few options, like TkInter or PyQt, but personally I really like PySimpleGUI. It really makes GUI programming Pythonic, like, layout is just a list. And you can get started within 5 minutes.
You can make a standalone application of your python script with pyinstaller (http://www.pyinstaller.org/)
For a basic purely-text choose your adventure game this should be not too complicated for Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.
Be aware some old, outdated virus scanners can give false alarm on Windows for such standalones. Be prepared to answer your friends questions.
You can't "save" it as exe, such request may scare any Python developer:) However, you can use http://www.py2exe.org or http://www.pyinstaller.org to create standalone Python environment and run it as regular Windows application.
In Python (for Windows) you'd want to use PyInstaller to create an executable that can be run with all of the dependencies bundled inside. And use Inno or NSIS to create an installer.
Yes, if you just distributed the .py
files, users would have to install the dependencies and run the script.
But you can use something like PyInstaller to create executables.
>What I want is an executable that's pinned to my taskbar and when opened will generate a console that runs this code.
You can use pyinstaller to generate an executable.
pip install pyinstaller
pyinstaller --onefile my_python_script.py
>Also, is there a way to set a default "gen" value where if I skip the line "gen = input("What generation? options are RB, GS, RS, DP, BW, XY, SM ")" it'll just set a default value?
What do you mean by skip? If you just mean the user provides blank input, then you could do the following (based on :
gen = input("What generation? options are RB, GS, RS, DP, BW, XY, SM ") or "MY_DEFAULT_VALUE"
(note: I'm assuming you're using python3?)
Exe is Windows only. So you cannot export an "executable" to run on every operating system. You can export a separate application for each operating system (from that operating system) using PyInstaller.
Python and any programming languages, except C, C++, Java, Kotlin and Swift, do not run on mobile phones.
But Python can run on any desktop operating systems (FreeBSD, Linux, macOS, Solaris, Windows, etc,). Sublime Text is one of examples. But to compile to all operating systems, you must install firstly pip
, and run pip
to install Nuitka and PyInstaller.
> Is it possible to compile different languages into one .exe?
In general, no. There are generally no multiple language compilers. In special cases you can maybe call C/C++ code from Python. But I don't know how well that behaves when you put it through something like pyinstaller to generate an exe.
The easiest way to just to learn to do everything in one language, Python has modules for just about anything. A more complicated but general solution is to make use of shared libraries, I've never done it but I know it's a pretty common practice.
> Can I then compile that Python script INTO my C++ program/.exe file so it appears to be running as one "app".
Look into pyinstaller. This gives you a .exe in the end. It works by embedding Python interpreter and all necessary extra libraries inside your single .exe file. It's not perfect (you end up with 30MB Hello World) but it works in some cases.
> To me, so far, the beauty of C++ is I can compile a .exe and the user doesn't really need to install anything, the .exe should just work. Where as, with my understanding, Java makes a .jar which requires users to install JRE.
This is true to a degree. Try compiling a C++ application using latest visual studio and then run it on Windows XP. It probably won't work and will likely complain about lack of certain dlls. In exchange for installing JRE you also get the some codebase for all your users. Whereas with C++ this is not guaranteed, especially with cross platform (and even on the same Windows - you have different Windows versions so certain built in headers and libraries also behave differently).
Compiling and distributing are completely separate things. Python already compiles your code when you run it. That's what those pyc files are. It does not usually make sense to distribute pyc files on their own because they are specific to the interpreter that created them. If you want to distribute pyc files then you also need to distribute the python interpreter along with them. The process of doing that has been automated by PyInstaller, which is what you should use.
I suppose you are using Windows. Python programs can be run simply by using the "main" interpreter: python.exe myprog.py
or pythonw.exe myprog.py
if you don't want to open the shell window. It doesn't matter what editor you use to edit the source code. Just make sure it uses 4 spaces as tabs. Ofcourse IDEs like PyCharm make your life a whole lot easier.
Just using the installed python.exe
works, but has some potential future problems, for example if you want to use pip
to install packages for your programs (which you'll definitely want to do), pip
will install packages straight inside your main Python install. There is a mechanism called virtual environments to solve that. Virtualenvs also make it possible to have a spesific version of Python interpreter and packages for your spesific project. I suggest you learn to use virtualenvs from the get go.
Another thing you could look at is using PyInstaller to create executable, distributable version of your program. Linux systems have Python preinstalled, but the version varies. Windows systems most likely don't have Python available and I think Macs do have? Using PyInstaller you don't have to worry about that. Virtualenvs combined with PyInstaller are powerful tools to develop real projects that you can easily distribute.
I have made a PR for python3 compatibility on GitHub, feel free to take a look when you have the time.
Also, do you know about http://www.pyinstaller.org ? It's a tool that allows packaging of python code as a standalone app, it could be a great way of distributing the code for people who don't have Python (never used it personally, but I know a few projects which use it).
Python geeks, what are your favorite libraries/packages? Mine's SciPy for my scientific computing and ODE crunching needs (also, numpy arrays FTW!) and pyinstaller to make my programs standalone executables in multiple platforms.
> Maybe, but I quite like the self contained nature of Electron apps (you don't need to install anything, just run the exe/app/Linux binary).
There are ways (PyInstaller) that can make a Windows/Mac/Linux binary, and Linux users already have Python installed, so they can just run source.
Not too difficult. Tkinter is a simple GUI library which you can use to prompt for a file/folder and then run your script.
Then you'll then want to use pyinstaller to create an executable.
Feel free to send me a message if you'd like some help with the Tkinter library.
Thanks for this information; I'm using "PyInstaller" to create the executable (see http://www.pyinstaller.org/ and https://github.com/pyinstaller/pyinstaller). There seems to be some problem with false positives in the past (see https://github.com/pyinstaller/pyinstaller/issues?q=is%3Aissue+virus+is%3Aclosed). My system is clean, so I believe this must be a false positive as well, but I will investigate. There are also other tools for packaging a Python application available, e.g. Py2Exe, but the reason I did use PyInstaller is that it's recently updated and also works with Python 3.5. Anyway, I will look into this.
Side note: I haven't had time to look at your idea on how to add a "minimize to tray" feature yet, but this is for sure doable in Python.
Yes you can. If there's a module that it's not working, you can try with another. Another example would be pyinstaller: http://www.pyinstaller.org/ > "Packaging of Python programs into standard executables, that work on computers without Python installed. > Multiplatform: works under > Windows (32-bit and 64-bit),"
That's what you're looking for, right?
Aye, should have made that clearer, although you could use pyinstaller or py2exe to build an executable for Windows. I am honestly unsure how well those two work currently, they were pretty handy last time I used them for getting some scripts working on Windows machines :)
pyinstaller I did have it in the post but when i rewrote it I guess I forgot it. Due to the version of Python I am using many utilities did not work properly. This also seemed far more straightforward than the others.
>Python 2.7 and 3.3—3.5 support
>Linux, Windows, OS X and FreeBSD support
>compatible with 3rd-party packages out-of-the-box
>As an example, libraries like PyQt, Django or matplotlib are fully supported
What about PyInstaller (http://www.pyinstaller.org/) ? I've been considering trying to use this for sharing a package with non-programmers, but if there are major issues with it, it would be great to hear about them now before I waste time diving through their docs.
Also, yeah, something for distributing applications (either with, or without all dependencies included) should just be a part of python.
"App" is just short for "application". With Kivy, the process of creating your app/application is the same on any platform, except you don't use the Android or iOS tools to compile your application, you use something like PyInstaller.
Apart from cx_Freeze and py2exe which were already mentioned in another post, you can also consider PyInstaller.
correct, no need for sudo pip install
. you can use the requirements file to quickly build a production environment with all the dependencies, or to put it on another developer machine. Do so with this command:
$ pip install -r requirements.txt
For executables: http://www.pyinstaller.org/ , http://www.py2exe.org/
If you are going to distribute Python programs to end-users (especially if they're running Windows), you might want to stick with Python 2 until PyInstaller gets upgraded.
You might try running it from the command line to see if you get error ouput. ShootOFF would show you a popup error message if it was for lack of a camera or similar.
Hit the start button then in the search box type "cmd" without quotes and hit enter. When the command prompt opens navigate to the folder where ShootOFF is installed by running a command like the following "cd C:\users\blakmag86\desktop\shootoff" (change the path the right one) without quotes then run "shootoff.exe". Do you get any error output?
Another possibility is your antivirus software is blocking it. This isn't a problem for more reputable AV products, but a few incorrectely flag it using a very generic heuristic due to the use of pyinstaller to make the Windows packages (http://www.pyinstaller.org/ticket/680).
I'm not sure how to, honestly, so if you want to you'd have to look up the information. I think py2app as well as pyInstaller both work.
>one thing I really don't like about python: it doesn't compile to native executables.
So i'm in the learning stages of python, doing web exercises, reading articles, etc.
What about the included python freeze utility? or things like pyinstaller or py2exe? Both of these programs are "ancient" in internet terms (10 yrs plus) and produce os-specific byte code of python scripts. Is this not what you're talking about?
I ask this from the POV of learning about computer science in general, that I may have terms and uses mixed up.
> But, then again, Python users always exposed of to the knowledge that Python application need a full blown installation of Python distribution (with all of its site-packages contents) in order for our application to be able to run smoothly.
Why are you doing that? You can use http://www.pyinstaller.org/ to make an exe
Well you could have them install python and run the file. Maybe PyInstaller would work? I haven't tried it, but it look alright. You can't run Python natively on iOS devices.
i wonder if it has to do with how you are acquiring numpy in the first place.
Did you grab it using easy install, or did you download the numpy installer?
Also, py2exe has problems with numpy
http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules
maybe give this a shot? http://www.pyinstaller.org/
Another option is to bundle python with your game.
You can probably create a mac application easily enough using py2app. There are similar tools you can use for Linux (cx_Freeze, PyInstaller), to bundle up all the files you need to run it. That approach isn't considered ideal for Linux distribution, but it's better than ignoring it.
Those tools will hide the code a bit, but bear in mind that there's no way to really stop people getting at Python code if they're determined.
I develop in-house software, and we are on Linux, so this isn't an issue. If I was to distribute a standalone binary for Windows end-users, I would have to compile to .exe, like any other Windows application. It seems like there are some tools out there to make this easier, such as py2exe and pyinstaller. Distribution and package management with Python isn't one of its strongest points out of the box, but there are good solutions out there I think.
PyInstaller is not in your list, and I have had a lot of success with writing one .spec file and my program compiling on windows Linux and mac, so I suggest giving it a try if you haven't.
actually, this is the only error i have ever encountered with it, and is easily solved:
We currently use Py2exe for our project. We are considering transitioning over to PyInstaller which plays more nicely with more recent Python versions (2.6+ is easily supported). I am on Windows 7 64 bit, but running 32-bit Python.
I have had good luck using pyfltk as a GUI toolkit and pyinstaller to package it. The pyfltk GUI is simplistic, but simple is what I need at this point.
It is not terribly difficult to bundle all the dependencies with your game. Many java programs bundle jre, and the python runtime is even smaller.
You can do this by hand or you can try one of these:
For Linux PyInstaller is utterly fantastic for creating stand-alone binaries. You would package built versions of the libraries you want with it anyway to stop any incompatibilities with whatever libs the players distro supplies.