Python Forum

Full Version: python compiling and sql?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am just about to start using Python to learn some programming and before I start I just wonder about portability of anything I may write (which won't be much).

Two things come to mind:

. Will a Python prog compile to an .exe which I can distribute and if it won't is that unimportant or it signifies possible difficulties? Like I'm thinking if it doesn't then Python would need to be installed on any person's machine I sent the code to, I suppose?

. If I use SQL to keep the data in my progs would SQL need to be installed on the machines I sent the prog to?

I have made a start and I'm still at the confused stage but I'm using mysqldb instead of plain mysql. And I wonder about the ramifications of that? I've done it because I was sold on the persuasive page I came across but without fully understanding what I was doing.
python script you write can be executed on any platform (so long as the interpreter has been installed)

see https://packaging.python.org/overview/ for 'packaging' options
The DBMS of choice will, need to be installed. This is true of any language that I can think of.
Python is a programming language, not a DBMS.
That being said, it has binding to just about any DBMS that i can think of.
This is made very easy if you use SQLalchemy (i have tutorial here: https://python-forum.io/Thread-SqlAlchem...-Data-Load )

if you use SQLalchemy, changing DBMS is as simple as changing a single line (but there are sometimes differences with models from one to another)
You can create binary executable (e.g. exe for Windows). I would recommend PyInstaller
Quote:PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules.
As an alternative you can bundle python with your code, creating installer with pynsist
Quote:Pynsist is a tool to build Windows installers for your Python applications. The installers bundle Python itself, so you can distribute your application to people who don’t have Python installed.


(Oct-26-2020, 10:18 PM)abrogard Wrote: [ -> ]If I use SQL to keep the data in my progs would SQL need to be installed on the machines I sent the prog to?
What SQL? If you use file-like db like sqlite3 you can have it bundled with your script.
Using other server db - like mysql, will require that you connect to some db server. if it will be on the same machine or somewhere on the net/network is up to you. I.e. it will need to be installed and set up