Python Forum
python compiling and sql?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python compiling and sql?
#1
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.
Reply
#2
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)
buran likes this post
Reply
#3
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  compiling with an undefined variable Skaperen 0 998 Nov-10-2022, 11:59 PM
Last Post: Skaperen
  compiling numpy, getting C source Skaperen 10 3,727 Nov-20-2021, 12:41 AM
Last Post: Skaperen
  cross-compiling python with zlib support michelebucca 5 5,879 Aug-25-2020, 08:19 PM
Last Post: carterb
  compiling various versions of Python, which toolchain? Skaperen 4 2,725 Jun-06-2019, 06:28 AM
Last Post: Skaperen
  compiling to python-- should ; be used or not? ezdev 4 3,798 Jan-03-2018, 07:31 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020