"Portable executable" usually means that the program resides on
removable media, like a USB stick. You can go to a computer, plug the
stick in, and run the program. If it's Python, then the installation on
the removable medium needs to set up all the paths and directories
correctly before actually running Python. That would typically be done
with batch files setting paths and environmental variables.
I got this working for Python on Windows some years ago. Here is the
setup batch file I used - it gets executed when the user types "pyth37":
@echo off
setlocal
: Find effective drive for this file.
set ed=%~d0
path %ed%\python37\Scripts;%ed%\python37;%PATH%
set PYTHONUSERBASE=%ed%\user\python
set HOME=%ed%\user\python
call python %*
endlocal
It might need to be be more complex on MacOS, but it gives you the idea.
The odd-looking line "set ed=%~d0" is a Windows-specific way to get
the drive of the command file being run.
On 10/20/2022 4:53 PM, Cameron Simpson wrote:
On 20Oct2022 03:01, wdamn <wallacechemi...@gmail.com> wrote:
I would like to have a portable executable of python3 on OSX.
I google a lot about it, but I could not find any solution.
Am I missing something or is it simply not possible?
I'm not sure what you mean. My Mac comes presupplied with Python 3, and
I'd expect any modern Mac to be the same. So a python 3 programme should
work on any Mac.
If you mean: "how do I write a Python script to use python 3?" the usual
approach is to start the script with a shebang line like this:
#!/usr/bin/env python3
On _any_ UNIX or UNIXlike system (OSX/MacOS is a BSD derived UNIX) this
will run the script with your usual "python3" command if you invoke the
script as a command.
Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list