How to provide python scripts to someone without python installed - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to provide python scripts to someone without python installed (/thread-1234.html) |
How to provide python scripts to someone without python installed - jak123456 - Dec-15-2016 so I've recently learned some basic python knowledge,and tried to send the file to someone without python installed,and he was unable to open it. i was confused as why would python be a thing without the ability to open the script you create? its like opening a shop in real life but having no doors. i was sure python was pretty popular,but why can't it be opened on its own? or is there an easy way of converting it into an .exe? if not,whats the point of python? to be used only for personal use? theres no way. anyway,please reply. RE: Need a question answered - Yoriz - Dec-15-2016 You can use the likes of pyinstaller and cx_freeze. RE: Need a question answered - micseydel - Dec-15-2016 If you Google "python to exe" there are tools for making it more convenient for the recipient. That said, they can always download Python, just like they almost certainly downloaded Java to run Java programs. Also, Python tends to come pre-installed on Linux and OS X, although Windows (which uses .exe) does indeed have this hurdle. RE: Need a question answered - Larz60+ - Dec-15-2016 Python is an interpretive language. A statement is compiled as it is encountered, the compiler (and interrupter) are separate from the script, but the script is dependent on them to run. Other languages that are interpreted include Java which is actually a hybrid, it's first compiled into byte code that must be run by JVM Lisp, Pike, Ruby and Forth are others. Interpretive languages can be run as the code is entered, making them ideal for development. Compiled languages like C, C++, Fortran or Pascal must first be compiled, so development is a cycle of write code, compile, test, but when done, you have an executable program that will run on it's own. There are scripts that bundle other scripts and interpreter together so they can be run without having an installed interpreter installed, Pyinstaller is one of these RE: Need a question answered - micseydel - Dec-15-2016 (Dec-15-2016, 07:32 PM)Larz60+ Wrote: Other languages that are interpreted include Java which is actually a hybridPython does this too, that's what .pyc files are, and some interpreters like PyPy even do JIT compilation. For the op though, the solution to the problem regardless of all the interesting background is to send the interpreter along with the script (which is what the .exe converters do) or the recipient of the script also installs Python, just like they would Java (and to your point, Ruby, Perl or whatever else). RE: Need a question answered - Ofnuts - Dec-15-2016 (Dec-15-2016, 07:17 PM)jak123456 Wrote: i was sure python was pretty popular,but why can't it be opened on its own? or is there an easy way of converting it into an .exe? See other posts for a technical answer. But remember that your .exe is of no use to OSX and Linux users... Universality is in the eye of the beholder... RE: Need a question answered - jak123456 - Dec-16-2016 Thanks for clearing things up guys,but i have no idea how to actually work with the programs you provided. for example py2 only works for older versions and cx freeze has a weird file type which means i don't know how to open it. ill try again later in the afternoon but if anyone knows how to operate these it'll be great RE: Need a question answered - Larz60+ - Dec-16-2016 For most packages, you can go to PyPi, look up the package and read the docs. RE: How to provide python scripts to someone without python installed - snippsat - Dec-16-2016 (Dec-16-2016, 08:04 AM)jak123456 Wrote: cx freeze has a weird file type which means i don't know how to open it.No cx_Freeze give as example an "exe" file. The most updated for newer Python version are PyInstaller, cx_Freeze and pynsist 1.9. RE: How to provide python scripts to someone without python installed - Yoriz - Dec-17-2016 This is an example of using cx_freeze on the sample file SimpleTkApp.py and its setup.py provided with cxfreeze using python 3.
To do this on your own file copy the setup.py file to the location of your py file, alter the setup.py to suit your .py file ie change 'SimpleTkApp.py' to your .py name executables = [ Executable('SimpleTkApp.py', base=base) ]Follow the above substituting the file path to your .py folder. |