Portable executable - PyInstaller on macOS #5858
Replies: 13 comments
-
Do you know where the XCode requirement comes from? The frozen application should not require it per-se, so this sounds like there's something in your code that's depending on XCode (could also be one of its utility programs, like something in your code spawning a |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply @rokm ! I did a very basic Django app that uses HTML, CSS, Python, and some panda to read CSV. More over, my python script first open a browser on the right url and then start the server with the command `python3 manage.py runserver' (this is the command to start the localhost server for django). Do you have any idea ? There is my python code in the manage.py file :
|
Beta Was this translation helpful? Give feedback.
-
Nope. What I meant is, if you're using Can you post the error message about requiring XCode (and any messages preceding it)? Hopefully that will shed some light on the context in which this is occurring... |
Beta Was this translation helpful? Give feedback.
-
Hmm okay, i see, but no i do not call git command in my app. Actually i've tried importing django in my script where i start the server and open the browser and now i have much more package and files in my dist folder, so i'll try now like this. For the error i think it was something like Xcode is not present in the folder app, like the app wasn't found. My sister went back to work, I'll try now that i have new things and i'll get back to you when i'll have some news and also the exact error code. Anyway, thaks a lot for your time ! |
Beta Was this translation helpful? Give feedback.
-
So I did import django in my script and now it works better. But now i have another issue : i have to use python3 to use django. So when i try executing the executable on my sister's mac, i have the error (The command line says) :
And then i have a pop up window that tells me :
I also tried using the command |
Beta Was this translation helpful? Give feedback.
-
Ah yes, The problem you have that something in your code (probably Django) is trying to spawn python3 interpreter. Which beats the point of freezing the application in the first place, as that python3 process will likely require full environment. So you'll need to find what exactly is going on and see if you can work around it. (It could be the |
Beta Was this translation helpful? Give feedback.
-
Yeah I actually use the command : I've tried using only python but django needs to use python3 to be able to launch the server. Could i maybe activate the environement manually or maybe just simply include python3 in my PyInstaller or something like this ? My script is pretty simple :
|
Beta Was this translation helpful? Give feedback.
-
PyInstaller does not bundle python interpreter executable. It bundles python's shared library, and uses that to set up embedded interpreter to run the frozen script (with its collected resources). If you want to spawn the interpreter, you will need to have it installed on your target machine. Along with the full environment you need to actually run the script you're trying to run. So in this case, you'd need to install python3 and django on your sister's Mac, and there's no point in using PyInstaller at all. I think typically, you'd use PyInstaller to freeze your Django project and generate executable out of the |
Beta Was this translation helpful? Give feedback.
-
Ohh yeah okay i see! I just didn't really understand the last part (sorry i'm not fluent in english). Are you meaning that i could just use the same script as before but instead of calling Anyway thanks a lot for the time you're according to my issue, I appreciate it! |
Beta Was this translation helpful? Give feedback.
-
You definitely should be freezing your Django project, if you plan to deploy it elsewhere. Then you could probably run your simple script in old python2 as well, since all it'd be doing would be opening web browser via What you were doing now, you were freezing your "launcher" script and some of Django modules, but none of your actual Django project... (On a side note, I'm not overly familiar with Django, much less with freezing it under PyInstaller, so I can't help you much with that). |
Beta Was this translation helpful? Give feedback.
-
Okay i see! Last question, do you know how to freeze my Django project ? Because you've seen that when I want to start the server I have to call the file manage.py with the command runsever. Do you mean that i should apply the pyInstaller on the manyge.py file instead of my launcher script ? |
Beta Was this translation helpful? Give feedback.
-
Yeah, I would try freezing the |
Beta Was this translation helpful? Give feedback.
-
Okay, i'll try checking all this out, |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I have a small issue : I am creating a little django app for my sister and i'm developping it on macOS. I almost finished developping it, and i would like to create an executable so my sister doesn't have to run the commands by herself to start the localhost server etc.
To do so I wanted to use pyInstaller and that's the first time i'm using it.
So i've created a python script that start the localhost server and open a browser on the right url.
This works well for me and everything is fine on my computer.
The issue i have and i haven't thought about it at first is that when i tried using it on my sister's mac, it told me that it needed Xcode.
It's kind of annoying for her to download it only for this little app. That's why i was looking for a way to include dev tools from Xcode or anything like that, but didn't find anything interesting on internet.
Do you have any idea how i could avoid this issue ?
Thank you very much for the time you took reading this,
Patrick
Beta Was this translation helpful? Give feedback.
All reactions